Files with Variable Length Records
When technology complements business   Processing with Standard COBOL Dialect
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved http://www.simotime.com

 
Introduction Version 05.01.01
 
  Programming Objectives
  Programming Input and Output
  Programming Requirements
  Programming Overview
 
  Create a File with Fixed Length Records
  Convert a Fixed Length File to a File with Variable Length Records
  Convert Variable-Length File to Fixed-Length File
  Compare Two Sequential Files
  Sample CMD Members for Windows and Net Express
 
  CMD to Create a Sequential File with Fixed-Length Records
  CMD to Convert a Fixed Length File to a Sequential File with Variable-Length Records
  CMD to Convert a Variable-Length File to a Fixed-Length File
  CMD to Compare Two Files
  Sample JCL Members for OS/390 or Mainframe Express
 
  JCL to Create a Sequential File with Fixed-Length Records
  JCL to Convert a Fixed Length File to a Sequential File with Variable-Length Records
  JCL to Convert a Variable-Length File to a Fixed-Length File
  JCL to Compare Two Files
  COBOL Source Code for Sample Programs
 
  Convert a Fixed Length File to a Sequential File with Variable-Length Records
  Convert a Variable Length file to a Fixed-Length File
  Compare Two Sequential Files
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This document describes how to create, access and convert data files that use variable-length-records. There are different ways to create and access files with variable length records. The following list briefly describes three possible methodologies. The examples provided in this suite of programs will focus on the first methodology.

1. Define the record as a single field (my-data-field) with the physical size equal to the maximum record length. On the FD statement (in a COBOL program) use the "DEPENDING ON field-name-for-my-record-size" to define a field that will determine the size of the record to be written to a file. Next, determine the length of the text string within the single field (my-data-field) that defines the record layout. Place this value in the field-name-for-my-record-size and write the record. This may be accomplished by scanning the field to determine the position of the last significant character or by counting the number of trailing spaces.
Note: When the file is accessed as input the length of the record just read will be placed in the "field-name-for-my-record-size" field.
2. The file has multiple record types. Usually each record in the file has a base segment that is identical. User logic is created to determine the record type. For example, if position 1 is an "A" the record format "A" is used, If position 1 is a "B" then record format "B" is used. Each record format will have their own record layout (or copy file) and they may be the same length or a different length. Therefore, one way to create and access a file with variable length records is to use multiple record types where the different record types have a different record length.
3. The technique of defining an array (or table) as the last part of a record may be used. For COBOL, the "OCCURS DEPENDING ON" (or ODO) is used to vary the number of elements in the array (or table). Thus, the more elements in the array the longer the record and the fewer elements in the array the shorter the record.

The preceding describes three of the methods that are commonly used by COBOL application programmers to create and access files with variable length records. Additional detail about other tips, tricks and techniques used to manage files with variable length records are discussed in the following sections of this document.

The source code for the COBOL programs is written using the VS COBOL II dialect and also work with COBOL for MVS and COBOL/370. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows. A Windows Command (.CMD) file is provided to run the job on a PC with Micro Focus Net Express. Additional information is provided in the Downloads and Links to Similar Pages section of this document.

The compare function that is used in this example uses the SimoLOGS and SimoHEX4 routines and will require the common modules to be downloaded.

Programming Objectives
(Next) (Previous) (Table-of-Contents)

The following is a list of the functions provided in this example.

1. Demonstrate how to create a fixed-record-length, sequential file using mainframe JCL and the IEBGENER Utility program.
2. Demonstrate how to read the fixed-record-length, sequential file and create a variable-record-length, sequential file.
3. Demonstrate how to read the variable-record-length, sequential file and create a fixed-record-length, sequential file.
4. Demonstrate how to compare the contents of two data files.

The first task performed by the CRTF80J1.JCL or CRTF80E1.CMD routine is to create a file of fixed-length, 80 byte records. The actual text string within the records will vary in size. To create fixed length records the record is padded with trailing spaces.

The second task performed will read the fixed, 80-byte-record file and create a file containing variable-length records,. The trailing spaces will be truncated.

The third task will read the file containing variable-length records and create a file containing 80-byte, fixed length records.

The fourth and final step will compare the original 80-byte, fixed-length file created in the first task with the 80-byte, fixed length file created in the third task.

Programming Input and Output
(Next) (Previous) (Table-of-Contents)

The input varies depending on the task being performed. Each task will read a sequential file. The format of the file may be fixed, 80-byte records or variable-length records. The output files will be sequential files and the format may be fixed, 80-byte records or variable-length records. For variable-length record the record length is determined by the number of trailing spaces.

Programming Requirements
(Next) (Previous) (Table-of-Contents)

This suite of samples programs will run on the following platforms.

1. Executes on Windows/2000, Windows/NT and Windows/XP using Micro Focus Net Express and the CMD file provided.
2. May be ported to run on the UNIX platforms supported by Micro Focus COBOL.
3. Executes on a mainframe with MVS or Windows/2000, Windows/NT and Windows/XP using Micro Focus Mainframe Express and the JCL file provided.

Programming Overview
(Next) (Previous) (Table-of-Contents)

The following diagram is an overview of how the demonstration program fits into the example. The  BLUE  boxes are unique to the mainframe and Micro Focus Mainframe Express. The  RED  boxes are unique to the PC with Windows and Micro Focus Net Express. The  GREEN  boxes are platform independent and will execute on the mainframe or a PC with Windows. Also, the  GREEN  boxes may be ported to a UNIX platform that is supported by Micro Focus COBOL. The  AQUA  boxes are used for data files.

Programming Overview, Create a File with Fixed Length Records
(Next) (Previous) (Table-of-Contents)

The following process will create a sequential file containing fixed-length, 80-byte records.

                   
Entry Point
OS390 or MFE
     
Entry Point
Net Express
      Entry Points  
 
     
 
         
CRTF80J1
jcl
     
CRTF80E1
cmd
      Start the job to create a file with fixed records.  
 
     
 
         
IEFBR14
exec
     
If Exist
stmt
      Delete previously created output file  
 
     
 
         
IEBGENER
exec
 
 
 
SQEDDF01
qsam
 
echo
stmt
 
 
 
SQEDDF01
qsam
  Create a new file with fixed-length, 80-byte records.  
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
         
   
EOJ
          End-of-Job  
                   

Programming Overview, Create a File with Variable Length Records
(Next) (Previous) (Table-of-Contents)

The following will read the file containing fixed length records and create a file containing variable length records. This example creates variable length records by removing the trailing space characters from the fixed length records.

               
Entry Point
OS390 or MFE
     
Entry Point
Net Express
  Entry Points  
 
     
 
     
CBLV80J1
jcl
     
CBLV80E1
cmd
  Start the job to create a file with variable records.  
 
     
 
     
IEFBR14
exec
     
If Exist
stmt
  Delete previously created output file  
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
SQEDDF01
qsam
 
 
 
CBLV80C1
cobol
 
 
 
VREDDV01
qsam
  Create a file containing variable-length records.  
   
 
         
   
EOJ
      End-of-Job  
               

Programming Overview, Convert Variable-Length to Fixed-Length
(Next) (Previous) (Table-of-Contents)

The following will read the file containing variable-length records and create a file containing fixed-length records.

               
Entry Point
OS390 or MFE
     
Entry Point
Net Express
  Entry Points  
 
     
 
     
CBLV80J2
jcl
     
CBLV80E2
cmd
  Start the job to convert a file with variable records to a file with fixed length records.  
 
     
 
     
IEFBR14
exec
     
If Exist
stmt
  Delete previously created output file  
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
VREDDV01
qsam
 
 
 
CBLV80C2
cobol
 
 
 
SQEDDF01
qsam
  Create a file containing fixed-length records.  
   
 
         
   
EOJ
      End-of-Job  
               

Programming Overview, Compare Two Files
(Next) (Previous) (Table-of-Contents)

The following will read the two sequential files containing fixed-length records and compare the contents of each record. If the contents are not equal an entry will be written to a log file.

               
Entry Point
OS390 or MFE
     
Entry Point
Net Express
  Entry Points  
 
     
 
     
CBLV80J3
jcl
     
CBLV80E3
cmd
  Start the job to compare the two sequential files.  
 
     
 
     
IEFBR14
exec
     
If Exist
stmt
  Delete previously created log file  
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
SQEDDF01
qsam
     
     
     
CBLV80C3
cobol
 
 
 
SYSLOG
qsam
  Compare the two files containing fixed-length records.  
SQEDDF02
qsam
     
     
     
 
         
   
 
         
   
EOJ
      End-of-Job  
               

Sample CMD Members, Windows and Net Express
(Next) (Previous) (Table-of-Contents)

This sample suite of programs has four CMD members. The following table is a list of the sample CMD members.

Command Description
CRTF80J1.CMD Create a sequential file containing fixed-length, 80-byte records.
CBLV80J1.CMD Read the sequential file created in the preceding job and write to a sequential file containing variable-length records.
CBLV80J2.CMD Read the file created in the preceding step and write a new sequential file containing fixed-length, 80-byte records.
CBLV80J3.CMD Read the two sequential files containing fixed-length, 80-byte records and compare the records. If not equal then write an entry to a log file.

Sample CMD, Create a Sequential File with Fixed-Length Records
(Next) (Previous) (Table-of-Contents)

The following is the CMD (CRTF80E1.CMD) that is used to create a sequential file containing fixed-length, 80-byte records. The text string within the records is variable-length with trailing spaces.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Create Sequential Data Sets.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The 1st step (DeleteTEXT) will delete any previously created files.
rem  *
rem  * The 2nd step (CreateTEXT) will create a new ASCII/Text file.
rem  *
rem  * The 3rd job step (ConvertLSEQtoRSEQasc) will create a new Record
rem  * Sequential file with ASCII-encoded, fixed length records.
rem  *
rem  * The 4th job step (ConvertLSEQtoRSEQebc) will create a new Record
rem  * Sequential file with EBCDIC-encoded, fixed length records.
rem  *
rem  * This set of programs will run on a Personal Computer with
rem  * Windows and Micro Focus Net Express.
rem  * *******************************************************************
rem  * Step   1 of 2  Set the global environment variables,
rem  *                Delete any previously created file...
rem  *
     set CmdName=CrtF80E1
     call Env1PROD
     set JobStatus=0000
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
:DeleteQSAM
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Identify JobStep DeleteQSAM"
     set SQEDDF01=%BaseLib1%\DataLibA\Txt1\SQEDDF01.TXT
     if exist %SQEDDF01% del %SQEDDF01%
REM  *
REM  * *******************************************************************
REM  * Step   2 of 2  Create and populate a new TEXT file...
REM  *
:CreateTEXT
     call SimoNOTE Identify JobStep CreateQSAM"
rem  *...:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
echo 000000000001 A                                                                  >>%SQEDDF01%
echo 000000000002 AB                                                                 >>%SQEDDF01%
echo 000000000003 ABC                                                                >>%SQEDDF01%
echo 000000000004 ABCD                                                               >>%SQEDDF01%
echo 000000000005 ABCDE                                                              >>%SQEDDF01%
echo 000000000006 ABCDEF                                                             >>%SQEDDF01%
echo 000000000007 ABCDEFG                                                            >>%SQEDDF01%
echo 000000000008 ABCDEFGH                                                           >>%SQEDDF01%
echo 000000000009 ABCDEFGHI                                                          >>%SQEDDF01%
echo 000000000010 ABCDEFGHIJ                                                         >>%SQEDDF01%
echo 000000000011 ABCDEFGHIJK                                                        >>%SQEDDF01%
echo 000000000012 ABCDEFGHIJKL                                                       >>%SQEDDF01%
echo 000000000013 ABCDEFGHIJKLM                                                      >>%SQEDDF01%
echo 000000000014 ABCDEFGHIJKLMN                                                     >>%SQEDDF01%
echo 000000000015 ABCDEFGHIJKLMNO                                                    >>%SQEDDF01%
echo 000000000016 ABCDEFGHIJKLMNOP                                                   >>%SQEDDF01%
echo 000000000017 ABCDEFGHIJKLMNOPR                                                  >>%SQEDDF01%
echo 000000000018 ABCDEFGHIJKLMNOPQR                                                 >>%SQEDDF01%
echo 000000000019 ABCDEFGHIJKLMNOPQRS                                                >>%SQEDDF01%
echo 000000000020 ABCDEFGHIJKLMNOPQRST                                               >>%SQEDDF01%
echo 000000000021 ABCDEFGHIJKLMNOPQRSTU                                              >>%SQEDDF01%
echo 000000000022 ABCDEFGHIJKLMNOPQRSTUV                                             >>%SQEDDF01%
echo 000000000023 ABCDEFGHIJKLMNOPQRSTUVW                                            >>%SQEDDF01%
echo 000000000024 ABCDEFGHIJKLMNOPQRSTUVWX                                           >>%SQEDDF01%
echo 000000000025 ABCDEFGHIJKLMNOPQRSTUVWXY                                          >>%SQEDDF01%
echo 000000000026 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                         >>%SQEDDF01%
echo 000000000027 ABCDEFGHIJKLMNOPQRSTUVWZXZ0123456789                               >>%SQEDDF01%
echo 000000000028 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                         >>%SQEDDF01%
echo 000000000029 ABCDEFGHIJKLMNOPQRSTUVWXY                                          >>%SQEDDF01%
echo 000000000030 ABCDEFGHIJKLMNOPQRSTUVWX                                           >>%SQEDDF01%
echo 000000000031 ABCDEFGHIJKLMNOPQRSTUVW                                            >>%SQEDDF01%
echo 000000000032 ABCDEFGHIJKLMNOPQRSTUV                                             >>%SQEDDF01%
echo 000000000033 ABCDEFGHIJKLMNOPQRSTU                                              >>%SQEDDF01%
echo 000000000034 ABCDEFGHIJKLMNOPQRST                                               >>%SQEDDF01%
echo 000000000035 ABCDEFGHIJKLMNOPQRS                                                >>%SQEDDF01%
echo 000000000036 ABCDEFGHIJKLMNOPQR                                                 >>%SQEDDF01%
echo 000000000037 ABCDEFGHIJKLMNOPQ                                                  >>%SQEDDF01%
echo 000000000038 ABCDEFGHIJKLMNOR                                                   >>%SQEDDF01%
echo 000000000039 ABCDEFGHIJKLMNO                                                    >>%SQEDDF01%
echo 000000000040 ABCDEFGHIJKLMN                                                     >>%SQEDDF01%
echo 000000000041 ABCDEFGHIJKLM                                                      >>%SQEDDF01%
echo 000000000042 ABCDEFGHIJKL                                                       >>%SQEDDF01%
echo 000000000043 ABCDEFGHIJK                                                        >>%SQEDDF01%
echo 000000000044 ABCDEFGHIJ                                                         >>%SQEDDF01%
echo 000000000045 ABCDEFGHI                                                          >>%SQEDDF01%
echo 000000000046 ABCDEFGH                                                           >>%SQEDDF01%
echo 000000000047 ABCDEFG                                                            >>%SQEDDF01%
echo 000000000048 ABCDEF                                                             >>%SQEDDF01%
echo 000000000049 ABCDE                                                              >>%SQEDDF01%
echo 000000000050 ABCD                                                               >>%SQEDDF01%
echo 000000000051 ABC                                                                >>%SQEDDF01%
echo 000000000052 AB                                                                 >>%SQEDDF01%
echo 000000000053 A                                                                  >>%SQEDDF01%
echo 000000000054 a                                                                  >>%SQEDDF01%
echo 000000000055 ab                                                                 >>%SQEDDF01%
echo 000000000056 abc                                                                >>%SQEDDF01%
echo 000000000057 abcd                                                               >>%SQEDDF01%
echo 000000000058 abcde                                                              >>%SQEDDF01%
echo 000000000059 abcdef                                                             >>%SQEDDF01%
echo 000000000060 abcdefg                                                            >>%SQEDDF01%
echo 000000000061 abcdefgh                                                           >>%SQEDDF01%
echo 000000000062 abcdefghi                                                          >>%SQEDDF01%
echo 000000000063 abcdefghij                                                         >>%SQEDDF01%
echo 000000000064 abcdefghijk                                                        >>%SQEDDF01%
echo 000000000065 abcdefghijkl                                                       >>%SQEDDF01%
echo 000000000066 abcdefghijklm                                                      >>%SQEDDF01%
echo 000000000067 abcdefghijklmn                                                     >>%SQEDDF01%
echo 000000000068 abcdefghijklmno                                                    >>%SQEDDF01%
echo 000000000069 abcdefghijklmnop                                                   >>%SQEDDF01%
echo 000000000070 abcdefghijklmnopr                                                  >>%SQEDDF01%
echo 000000000071 abcdefghijklmnopqr                                                 >>%SQEDDF01%
echo 000000000072 abcdefghijklmnopqrs                                                >>%SQEDDF01%
echo 000000000073 abcdefghijklmnopqrst                                               >>%SQEDDF01%
echo 000000000074 abcdefghijklmnopqrstu                                              >>%SQEDDF01%
echo 000000000075 abcdefghijklmnopqrstuv                                             >>%SQEDDF01%
echo 000000000076 abcdefghijklmnopqrstuvw                                            >>%SQEDDF01%
echo 000000000077 abcdefghijklmnopqrstuvwx                                           >>%SQEDDF01%
echo 000000000078 abcdefghijklmnopqrstuvwxy                                          >>%SQEDDF01%
echo 000000000079 abcdefghijklmnopqrstuvwxyz                                         >>%SQEDDF01%
echo 000000000080 abcdefghijklmnopqrstuvwzxz0123456789                               >>%SQEDDF01%
echo 000000000081 abcdefghijklmnopqrstuvwxyz                                         >>%SQEDDF01%
echo 000000000082 abcdefghijklmnopqrstuvwxy                                          >>%SQEDDF01%
echo 000000000083 abcdefghijklmnopqrstuvwx                                           >>%SQEDDF01%
echo 000000000084 abcdefghijklmnopqrstuvw                                            >>%SQEDDF01%
echo 000000000085 abcdefghijklmnopqrstuv                                             >>%SQEDDF01%
echo 000000000086 abcdefghijklmnopqrstu                                              >>%SQEDDF01%
echo 000000000087 abcdefghijklmnopqrst                                               >>%SQEDDF01%
echo 000000000088 abcdefghijklmnopqrs                                                >>%SQEDDF01%
echo 000000000089 abcdefghijklmnopqr                                                 >>%SQEDDF01%
echo 000000000090 abcdefghijklmnopq                                                  >>%SQEDDF01%
echo 000000000091 abcdefghijklmnor                                                   >>%SQEDDF01%
echo 000000000092 abcdefghijklmno                                                    >>%SQEDDF01%
echo 000000000093 abcdefghijklmn                                                     >>%SQEDDF01%
echo 000000000094 abcdefghijklm                                                      >>%SQEDDF01%
echo 000000000095 abcdefghijkl                                                       >>%SQEDDF01%
echo 000000000096 abcdefghijk                                                        >>%SQEDDF01%
echo 000000000097 abcdefghij                                                         >>%SQEDDF01%
echo 000000000098 abcdefghi                                                          >>%SQEDDF01%
echo 000000000099 abcdefgh                                                           >>%SQEDDF01%
echo 000000000100 abcdefg                                                            >>%SQEDDF01%
echo 000000000101 abcdef                                                             >>%SQEDDF01%
echo 000000000102 abcde                                                              >>%SQEDDF01%
echo 000000000103 abcd                                                               >>%SQEDDF01%
echo 000000000104 abc                                                                >>%SQEDDF01%
echo 000000000105 ab                                                                 >>%SQEDDF01%
echo 000000000106 a                                                                  >>%SQEDDF01%
     if exist %SQEDDF01% goto :ConvertLSEQtoRSEQasc
     set JobStatus=0010
     goto :EojNok
:Jump10
:ConvertLSEQtoRSEQasc
rem  *
rem  * *******************************************************************
rem  * Step 3, Read the previously created Line Sequential File (LSEQ)
rem  *         and write a Record Sequential File (RSEQ) with 80-byte,
rem  *         ASCII-encoded records.
rem  *
     call SimoNOTE "Identify JobStep ConvertLSEQtoRSEQasc"
     set GETLS080=%SQEDDF01%
     set PUTRS080=%BaseLib1%\DataLibA\Asc1\SIMOTIME.DATA.SQEDDF01.DAT
     if exist %PUTRS080% del %PUTRS080%
     run ALAR80C1
     if not exist %PUTRS080% set JobStatus=0030
     if not "%JobStatus%" == "0000" goto EojNok
     call SimoNOTE "Produced DataSet %PUTRS080%"
rem  *
:ConvertLSEQtoRSEQebc
rem  *
rem  * *******************************************************************
rem  * Step 4, Read the previously created Line Sequential File (LSEQ)
rem  *         and write a Record Sequential File (RSEQ) with 80-byte,
rem  *         EBCDIC-encoded records.
rem  *
     call SimoNOTE "Identify JobStep ConvertLSEQtoRSEQebc"
     set GETLS080=%SQEDDF01%
     set PUTRS080=%BaseLib1%\DataLibA\Ebc1\SIMOTIME.DATA.SQEDDF01.DAT
     if exist %PUTRS080% del %PUTRS080%
     run ALER80C1
     if not exist %PUTRS080% set JobStatus=0004
     if not "%JobStatus%" == "0000" goto EojNok
     call SimoNOTE "Produced DataSet %PUTRS080%"

:EojAok
     call SimoNOTE "Produced %SQEDDF01%"
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause

Sample CMD, Convert a Fixed Length File to a Sequential File with Variable-Length Records
(Next) (Previous) (Table-of-Contents)

The following is the CMD (CBLV80E1.CMD) used to read the file containing fixed-length, 80-byte records and create a file containing variable-length records. The input file was created in the preceding step (CRTF80E1.CMD) and contains variable length text string with trailing space characters to make the records fixed length. The output file will have variable length records consisting of the text string with the trailing spaces removed.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read a file of fixed-length records, write to a file of
rem  *          variable-length records.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The first job step (DeleteQSAM) will delete any previously created
rem  * file.
rem  *
rem  * The second job step (CreateQSAM) will read a file containing
rem  * 80-byte, fixed length records and create a file containing
rem  * variable length records
rem  *
rem  * This set of programs will run on a Personal Computer with
rem  * Windows and Micro Focus Net Express.
rem  *
rem  * ********************************************************************
rem  * Step 1 of 2, Set the global environment variables,
rem  *              Delete any previously created file...
rem  *
     set CmdName=CblV80E1
     call Env1PROD
     set JobStatus=0000
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Identify JobStep DeleteQSAM"
:DeleteQSAM
     set SQEDDF01=%BaseLib1%\DataLibA\Asc1\SIMOTIME.DATA.SQEDDF01.DAT
     set VREDDV01=%BaseLib1%\DataLibA\Asc1\SIMOTIME.DATA.VREDDV01.DAT
     if exist %VREDDV01% del %VREDDV01%
rem  *
rem  * *******************************************************************
rem  * Step 2 of 2, Repro, Read a file of fixed length records
rem  *              and write a file of variable length records.
rem  *
:CreateQSAM
     call SimoNOTE "Identify JobStep CreateQSAM"
     run CblV80C1
     if ERRORLEVEL 1 echo Error level is equal-to or greater-than 1 . . .
     if ERRORLEVEL 1 set JobStatus=0020
     if not "%JobStatus%" == "0000" goto :EojNOK
     echo errorlevel is 0 . . .
rem  *
     if exist %VREDDV01% goto :EojAok
     set JobStatus=0002
     goto :EojNok
:EojAok
     call SimoNOTE "Produced %VREDDV01%"
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause

Sample CMD, Convert a Variable-Length File to a Fixed-Length File
(Next) (Previous) (Table-of-Contents)

The following is the CMD (CBLV80E2.CMD) used to read the file containing variable length records and create a file containing fixed length records.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read a file containig variable-length records and write
rem  *          to a file containing fixed-length recorsds.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The first job step (DeleteQSAM) will delete any previously created
rem  * file.
rem  *
rem  * The second job step (CreateQSAM) will read the file of variable
rem  * length records and write to a file of fixed length records.
rem  *
rem  * This set of programs will run on a Personal Computer with
rem  * Windows and Micro Focus Net Express.
rem  *
rem  * ********************************************************************
rem  * Step 1 of 2, Set the global environment variables,
rem  *              Delete any previously created file...
rem  *
     set CmdName=CblV80E2
     call Env1PROD
     set JobStatus=0000
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     %BaseLib1%\DataLibA\Asc1\SIMOTIME.DATA.Identify JobStep DeleteQSAM"
:DeleteQSAM
     set VREDDV01=%BaseLib1%\DataLibA\Asc1\SIMOTIME.DATA.VREDDV01.DAT
     set SQEDDF02=%BaseLib1%\DataLibA\Wrk1\SIMOTIME.DATA.SQEDDF02.DAT
     if exist %SQEDDF02% del %SQEDDF02%
rem  *
rem  * *******************************************************************
rem  * Step 2 of 2, Repro, Read a file of variable length records
rem  *              and write a file of fixed length records.
rem  *
:CreateQSAM
     call SimoNOTE "Identify JobStep CreateQSAM"
     run CblV80C2
     if errorlevel = 1 set JobStatus=0020
     if not "%JobStatus%" == "0000" goto :EojNOK
rem  *
     if exist %SQEDDF02% goto :EojAok
     set JobStatus=0002
     goto :EojNok
:EojAok
     call SimoNOTE "Produced %SQEDDF02%"
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause

Sample CMD, Compare Two Files
(Next) (Previous) (Table-of-Contents)

The following is the CMD (CBLV80E3.CMD) used to compare the records within the two sequential files created in the preceding steps. If an unequal condition exist the records will be displayed and an entry will be written to the log file.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Compare two sequential files.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The first job step (DeleteQSAM) will delete any previously created
rem  * file.
rem  *
rem  * The second job step (CreateQSAM) will compare two sequential files.
rem  * If the records are not equal the information is displayed and an
rem  * entry is written to a log file.
rem  *
rem  * This set of programs will run on a Personal Computer with
rem  * Windows and Micro Focus Net Express.
rem  *
rem  * ************************