Scan an ASCII/Text File Search for a Text String |
The SimoTime Home Page |
Read an ASCII/Text File and search for the existence of a user-defined text string.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2023
SimoTime Technologies and Services
All Rights Reserved
This program will read each record in an ASCII/Text file. Each record is scanned for the possible presence of a user-defined text string.
| ||||||
Capabilities and Requirements |
The STSCANIT program sequentially reads an ASCII/Text (or Line Sequential) File. Each record is scanned (or searched) for the presence of a user-defined text string.
The following (FINDTXW1.cmd) is a sample command file that will scan a single ASCII/txt file.
@echo OFF rem * ************************************************************************ rem * FINDTXW1.CMD - a Windows Command File * rem * This Job Script is provided by SimoTime Technologies * rem * (C) Copyright 1987-2019 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ************************************************************************ rem * This job will scan a file searching for a user-defined text string. rem * ************************************************************************ rem * This job calls the following Windows Command Files or Programs. rem * 1. ENV1BASE.cmd - this provides a single point for setting commonly rem * used environment variables. rem * 2. SIMONOTE.cmd - this provides a consistent process for displaying rem * messages to the screen and writing to a journal or rem * log file. rem * 3. STSCANIT.gnt - Find a text string within a record within a file. rem * rem * This job accesses the following data files. rem * Input..... SYSUT1 - a Line Sequential File with a maximum Record rem * Length of 4096 bytes. rem * Output.... SYSUT2 - a Line Sequential File with a maximum Record rem * Length of 4096 bytes. rem * Control... SYSUT3 - a Line Sequential File with a maximum Record rem * Length of 256 bytes. rem * ************************************************************************ rem * rem * ************ rem * * FINDTXW1 * rem * ********cmd* rem * * rem * * rem * ************ rem * * ENV1BASE * rem * ********cmd* rem * * rem * * rem * ************ rem * * SIMONOTE * rem * ********cmd* rem * * rem * * rem * ************ rem * * RUN *---------------------------* rem * ********rts* * rem * * ************ ************ ************ rem * * * SYSUT1 *--*--* STSCANIT *-----* SYSUT2 * rem * * *******lseq* * ********cbl* *******lseq* rem * * * rem * * ************ * rem * * * SYSUT3 *--* rem * * *******lseq* rem * * rem * ************ rem * * EOJ * rem * ************ rem * rem * ************************************************************************ set CmdName=FINDTXW1 call ..\Env1BASE %CmdName% rem * call SimoNOTE "*******************************************************%CmdName%.CMD" call SimoNOTE "Starting JobName %CmdName%.CMD" rem * rem * Map Logical File Names to Physical File Names. set SYSUT1=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.TEXTFILE.txt set SYSUT2=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.MESSAGES.txt set SYSUT3=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.USERARGS.txt rem * rem * Delete possible files from a previous exution of this job. if exist %SYSUT1% erase %SYSUT1% if exist %SYSUT2% erase %SYSUT2% if exist %SYSUT3% erase %SYSUT3% rem * rem * Create SYSUT1, the File to be scanned. echo Record 001, a simple text string... >%SYSUT1% echo Record 002, a simple text string... >>%SYSUT1% echo Record 003, a simple text string with SIMOTIME... >>%SYSUT1% echo Record 004, a simple text string... >>%SYSUT1% echo Record 005, a simple text string... >>%SYSUT1% rem * rem * Create SYSUT2, an empty MESSAGES file. copy nul %SYSUT2% rem * rem * Create SYSUT3, a USERARGS file. echo /MATCH CASE >%SYSUT3% echo /SEARCH SIMOTIME >>%SYSUT3% rem * rem * Run the scan program. run STSCANIT if not "%ERRORLEVEL%" == "0" set JobStatus=0010 if not "%JobStatus%" == "0000" goto :EojNOK if not exist %SYSUT2% set JobStatus=0035 if not "%JobStatus%" == "0000" goto :EojNOK goto EojAok :EojAOK start NOTEPAD.EXE %SYSUT2% call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%" goto :End :EojNOK call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%" goto :End :End if not "%1" == "nopause" pause exit /B %JobStatus%
The following (FINDTXW2.cmd) is a sample command file that will scan multiple ASCII/txt files.
@echo OFF rem * ************************************************************************ rem * FINDTXW2.CMD - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2019 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ************************************************************************ rem * This procedure will scan a file searching for user-defined text string. rem * ************************************************************************ rem * This procedure calls the following Windows Command Files or Programs. rem * 1. Env1Base.CMD - this provides a single point for setting commonly rem * used environment variables. rem * 2. SimoNOTE.CMD - this provides a consistent process for displaying rem * messages to the screen and writing to a journal or rem * log file. rem * 3. FINDTXW7.CMD - Find a text string within a record within a file. rem * ************************************************************************ set CmdName=FINDTXW2 call ..\Env1BASE %CmdName% rem * call SimoNOTE "*******************************************************%CmdName%.CMD" call SimoNOTE "Starting JobName %CmdName%.CMD" rem * call SimoNOTE "Job_Step Map Logical File Names to Physical File Names." set SYSUT1=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.TEXTFILE.txt set SYSUT2=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.MESSAGES.txt set SYSUT3=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.USERARGS.txt set LISTFILE=%BASELIB1%\DATA\APPL\SIMOTIME.FIND.LISTFILE.txt rem * call SimoNOTE "Job_Step Delete possible files from a previous exution of this job." if exist %SYSUT2% erase %SYSUT2% if exist %SYSUT3% erase %SYSUT3% rem * call SimoNOTE "Job_Step Create SYSUT2, an empty MESSAGES file." copy nul %SYSUT2% rem * call SimoNOTE "Job_Step Create SYSUT3, a USERARGS file." echo /MATCH CASE>%SYSUT3% echo /SEARCH CUSTCB01>>%SYSUT3% rem * call SimoNOTE "Job_Step Run the scan program." set STSCANBF=YYNNNNNN/NNNNNNNN dir /on /b /a-d %BaseLib1%\COBOL\*.CBL>%LISTFILE% for /F "eol=; tokens=1,2* delims=." %%i in (%LISTFILE%) do call FINDTXW7 %%i cbl COBOL rem * if not "%ERRORLEVEL%" == "0" set JobStatus=0010 if not "%JobStatus%" == "0000" goto :EojNOK if not exist %SYSUT2% set JobStatus=0035 if not "%JobStatus%" == "0000" goto :EojNOK goto EojAok :EojAOK start NOTEPAD.EXE %SYSUT2% call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%" goto :End :EojNOK call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%" goto :End :End if not "%1" == "nopause" pause exit /B %JobStatus%
The preceding command will call the following command (FINDTXW7.cmd) to map the file name to be scanned and execute the program to scan the ASCII/Text files.
set SYSUT1=%BASELIB1%\%3\%1.%2 run STSCANIT rem *
This job will convert an ASCII-encoded, Line Sequential file of 80-byte logical records to an ASCII-encoded, Record Sequential file of 80-byte, fixed-length physical records. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact, Comment or Feedback section of this document.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.
Note: A SimoTime License is required for the items to be made available on a local server.
The following links may be to the current server or to the Internet.
Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connect.
You may view the download list of the SimoTime shared modules at http://www.simotime.com/sim4dzip.htm#groupSHARED.
Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
1. | Send an e-mail to our helpdesk. |
1.1. | helpdesk@simotime.com. |
2. | Our telephone numbers are as follows. |
2.1. | 1 415 763-9430 office-helpdesk |
2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
Return-to-Top |
Search for a Text String within a File |
Copyright © 1987-2023 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |