Variable Length Records
ZOS File Transfer and File Convert
  Table of Contents  v-16.01.01 - vrecex01.htm 
  Introduction
  Program Objectives
  Program Input and Output
  Program Requirements
  Program Process & Logic Diagram
  File Transfer Protocol (FTP)
  Sequential, Variable Length Records
  Convert the File
  Job Scripts
  Command File
  Bash Script File
  Environment Variables
  Mapping File Names
  Source Code for File Format Conversion Program
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

The objective of this suite of programs is to provide a solution for using FTP or Shared Network Disk to transfer a mainframe sequential file with variable length records to a Linux, UNIX or Windows System. Batch Job Scripts are provided to compile and execute the programs and review the results. The jobs have been tested on a Microsoft Windows/7 System using Command Files and Micro Focus COBOL technologies. The jobs have been tested on a Linux System (Ubuntu 16.04 LTS) using Bash Shell Scripts and GnuCOBOL.

The technique used will not require a file conversion on the ZOS Mainframe System. The sequential file with variable length records is transferred from the Mainframe System to the Linux, UNIX or Windows System using File Transfer Protocol (FTP) and BINARY Mode. The transfer is requested from the Linux, UNIX or Windows System using an FTP Client.

This suite of programs covers both the transfer and file format conversion of sequential files with variable length records. Other documents are available that will focus on file processing using standard COBOL with SELECT and FD definitions. Also, HTML documentation for Mainframe File Transfer using FTP commands is available.

This example makes a call to COBOL subroutines that are part of the SIMOMODS series of programs that are available from SimoTime.

Refer to the Download and Links section of this document for links to additional documents that discuss this topic.

Note: The called subroutines use COBOL functionality that is unique to Micro Focus or GnuCOBOL. Therefore, a non-mainframe dialect is required when compiling the subroutines. The COBOL programs have been tested with Micro Focus COBOL and GnuCOBOL using ASCII-encoding and a non-mainframe dialect.


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-2024
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Program Objectives

This example illustrates the following functions.

1 Transfer a file with variable length records from a Mainframe System to a Linux, UNIX or Windows system using the File Transfer Protocol (FTP) and binary mode.
2 Use the Byte-Stream I/O capability to read the mainframe formatted file with variable length records.
3 Use standard COBOL coding techniques to create a Micro Focus or GnuCOBOL file with variable length records.
  The Transfer and Conversion Process of Files with Variable Length Records

Table of Contents Previous Section Next Section Program Input and Output

A mainframe formatted sequential file with variable length records is the input to this suite of programs. The input file is transferred from the Mainframe system using the File Transfer Protocol (FTP) and BINARY mode. After the file is transferred from the Mainframe system to a Linux, UNIX or Windows system the file will be processed using COBOL programs.

The input file is a binary image of the mainframe file and the file types supported by this suite of sample programs are as follows.

Type  Description
Variable, if not specified the default value is 'V".
The four bytes preceding the logical record is the Record Descriptor Word. The content is as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word. 
3-4 Usually low values
VB  Variable Blocked
The four bytes preceding the logical record (Descriptor Word) are as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word. 
3-4 The length of the block including four-byte Descriptor Word.
VBS  Variable Blocked Spanned
The four bytes preceding the logical record is the Segment Descriptor Word. The content is as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word.
3 Segment Control Codes
Value  Relative position of segment
00 A complete logical record 
01 The first segment of a multiple segments record
02 The last segment of a multiple segments record
03 A middle segment of a multiple segments record
4 Low value, reserved for future use

The format of the output file is the user’s choice. This suite of jobs includes a Windows Command File that will create a Micro Focus file formatted with variable length records and a Bash Script that will create a GnuCOBOL file formatted with Variable length records.

Once the output file is created it may be processed with a COBOL program using standard COBOL coding techniques. At this stage of the process the record content is a mirror image of what was transferred from the Mainframe System. The records are text strings of EBCDIC-encoded data.

Refer to the  Map File Names  section of this document for additional information about setting environment variables to map program file names to physical file names.

Table of Contents Previous Section Next Section Program Requirements

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

1 The programs have been tested on a Windows System using Micro Focus COBOL Technologies and the command files provided.
2 The programs have been tested on a Linux System using GnuCOBOL Technologies and the Bash Files.
3 The Conversion programs were written, compiled and tested using Micro Focus Enterprise Developer and GnuCOBOL 2.0.
  Programming Requirements for the File Transfer and Convert Software

Table of Contents Previous Section Next Section Program Process & Logic Diagram

This suite of three COBOL programs will read a mainframe formatted sequential file with variable length records.

           
VRECEX01
cmd
The CMD member for running the application
   
IF Exist
stmt
Delete any previously created SQEDDV01 file
   
VRECEXC1
cbl
 
 
SQEDDV01
Read the mainframe formatted file and write the Micro Focus formatted file
   
   
   
End-of-File
Yes
No
   
call
 
 
   
   
   
SIMOVREC
cbl
Determine record size and prepare to get logical record
   
   
   
BSIODSN1
 
 
SIMOBSIO
cbl
Read specifies number of bytes from the file
   
   
   
   
   
EOJ
This is End-of-Job
 
Read a Mainframe Formatted Sequential File with Variable Length Records

Color Associations: The  light-green  boxes are unique to SIMOTIME Technologies using an IBM Mainframe System or Micro Focus Enterprise Developer. The  light-red  boxes are unique to the SIMOTIME Technologies using a Linux, UNIX or Windows System and COBOL Technologies such as Micro Focus. The  light-yellow  boxes are SIMOTIME Technologies, Third-party Technologies, decision points or program transitions in the processing logic or program generations. The  light-blue  boxes identify the input/output data structures such as Documents, Spreadsheets, Data Files, VSAM Data Sets, Partitioned Data Set Members (PDSM's) or Relational Tables. The  light-gray  boxes identify a system function or an informational item.

The following described each of the programs in more detail.

 Program Name Description
 VRECEXC1 This is the mainline program that calls SIMOVREC.CBL to process the logical records within the mainframe formatted file with variable length records. The records obtained by calling SIMOVREC.CBL are then written to a file using the standard COBOL format for files with variable length records. The output file is accessed using the standard COBOL coding techniques with the FD, SELECT, OPEN, WRITE and CLOSE.
 SimoVREC This program calls SIMOBSIO to read the file using byte-stream I/O. This program starts by requesting SIMOBSIO to do a four byte read of the file to get the RDW (Record Descriptor Word) or SDW (Segment Descriptor Word) . Based on the content of the RDW or SDW this program will call SIMOBSIO to do a read that is the length of the variable record or record segment (for VBS and record segments multiple reads may be required). The length of the record and its content is then passed back to the calling program. In this example the calling program is VRECEXC1.CBL.
 SimoBSIO This program does the byte-stream I/O and is able to read the file using a single byte or a variable-length, block-of-bytes based on the request from the calling program. In this example the calling program is SimoVREC.CBL.
  A Brief Description for each of the COBOL Programs

Table of Contents Previous Section Next Section File Transfer Protocol (FTP)

The File Transfer Protocol (or FTP) program is commonly used to transfer files between a Mainframe System and a Linux, UNIX or Windows (LUW) System. The Mainframe System has a variety of file structures, uses EBCDIC-encoded and has a variety of numeric formats. An understanding of file structures and their record structure/content will be required to successfully transfer files and maintain data integrity (especially for numeric values).

Table of Contents Previous Section Next Section Sequential, Variable Length Records

The following is a sample FTP script to retrieve (or GET) a sequential file with variable-length records from a Mainframe system to a Windows system. This FTP script is for using at the client or Windows system.

userid
password
CD ..
PWD
BINARY
QUOTE SITE RDW
GET mainframe.dataset.name drive:\directory\filename.ext
QUIT

The file must be transferred in BINARY. This will maintain the EBCDIC-encoding and the mainframe numeric formats for packed-decimal, binary and zoned-decimal data.

One of the following FTP statements must be used prior to a GET or PUT statement in order to download the Record-Descriptor-Word (RDW) and the possible Block-Descriptor-Word (BDW). The BDW and RDW are in binary format so it is critical to download in binary even if the records in the file are all text strings. Prior to a GET use one of the following statements.

QUOTE SITE RDW
   or
LITERAL SITE RDW

If the FTP process is to be executed on the mainframe the GET statement will need to be replaced with a PUT and the QUOTE or LITERAL statement will need to be replaced with the following statement.

LOCSITE RDW

Once the file is transferred it is a mirror of the mainframe format with EBCDIC-encoding. Each record is preceded by the Record Descriptor Word (RDW) and possible Block Descriptor Word (BDW) and must be converted to a Micro Focus formatted sequential file with variable length records. This process is described in the following sections of this document.

Table of Contents Previous Section Next Section Convert the File

The examples provided in this section use the three COBOL programs to convert a mainframe formatted, EBCDIC-encoded, sequential file with variable length records to a Micro Focus or GnuCOBOL formatted, EBCDIC-encoded, sequential file with variable length records.

Table of Contents Previous Section Next Section Job Scripts

A job script may be defined as a text file containing job setup information followed by job steps that identify programs to be executed along with parameters unique to the job step. A job script may be created using a text editor. The naming of a job script is determined by the Operating System. A simple job script may contain a single job step that performs a single function. A typical job script will contain multiple job steps executed in a predefined sequence. The status of each job step may be tested at the end of each job step.

Table of Contents Previous Section Next Section Command File

A sample Windows command file (VRECEXE1.cmd) is provided to show the steps necessary to set environment variables and map the file names used by the programs to the actual file names on the hard disk or other storage media.

@echo OFF
rem  * *******************************************************************
rem  *               VRECEXE1.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  *
rem  * Text   - Read a mainframe formatted file, write Micro Focus file.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will execute a mainline COBOL program that calls a routine
rem  * that will read a mainframe formatted file with variable length
rem  * records. The callable routine will use the byte-stream I/O
rem  * capability provided by Micro Focus.
rem  *
rem  * The mainline COBOL program uses stanard COBOL file processing
rem  * to write to a file that is a standard Micro Focus sequential file
rem  * with variable length records.
rem  *
rem  * This set of programs will run on a system using Microsoft Windows
rem  * and Micro Focus Net Express.
rem  *
rem  * Documentation is available at the following URL:
rem  * http://www.simotime.com/vrecex01.htm
rem  *
     setlocal
     call ..\Env1Base
     call SimoNOTE "*******************************************************VrecExE1"
     call SimoNOTE "Starting JobName VrecExE1, User is %USERNAME%"
rem  *
rem  * *******************************************************************
rem  * Step 1, Set File Mapping using environment variables
rem  *
:MapFileNames
     call SimoNOTE "Identify JobStep MapFileNames"
     set BSIODSN1=%BaseLib1%\DATA\Ftp1\FTPDDV01.dat
     set SQEDDV01=%BaseLib1%\DATA\Wrk1\SQEDDV01.dat
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_VRECEXW1.txt
rem  *
rem  * *******************************************************************
rem  * Step 2, Delete any previously created Micro Focus formatted file
rem  *
     if exist %SQEDDV01% del %SQEDDV01%
rem  *
rem  * *******************************************************************
rem  * Step 3, Read mainframe formatted sequential file using byte-stream,
rem  *         I/O. Create a new Micro Focus formatted sequential file.
rem  *         Note: the BSIOFMT1 environment variable must be set to
rem  *         V for Variable, VB for Variable Blocked or VBS for Variable
rem  *         Blocked Spanned.
rem  *
:ExecuteVariableBsio
     set JobStatus=0000
     set INITREC1=E
     set BSIOFMT1=V
     call SimoNOTE "Identify JobStep ExecuteVariableBsio"
     call SimoNOTE "DataTake %BSIODSN1%"
     call SimoNOTE "DataMake %SQEDDV01%"
     call SimoNOTE "SYSOUT.. %SYSOUT%"
     run VRECEXC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     if not exist %SQEDDV01% set JobStatus=0020
     if not %JobStatus% == 0000 goto :EojNok
rem  *
rem  * *******************************************************************
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section Bash Script File

The following is the Bash Shell Script (vrecexs1.sh) that is required to run as a job on a Linux or UNIX System. For this test case the COBOL programs were compiled and executed on a Linux (Ubuntu) System using GnuCOBOL.

#!/bin/bash
   JOBNAME=vrecexs1
#  * *******************************************************************
#  *       Bash Script File - provided by SimoTime Technologies        *
#  *           (C) Copyright 1987-2018 All Rights Reserved             *
#  *             Web Site URL:   http://www.simotime.com               *
#  *                   e-mail:   helpdesk@simotime.com                 *
#  * *******************************************************************
#  *
#  * Text    - Convert File with Variable Length Records, ZOS to GNU
#  * Author  - SimoTime Technologies
#  * Date    - November 11, 2003
#  * Version - 06.07.16
#  *
#  * The job will read a ZOS file with variable length records and
#  * create a GNU file with variable length records.
#  *
#  * This job does File Format conversion. It does NOT do record content
#  * conversion. The logical record content remains the same.
#  *
#  * ********************************************************************
#  * Step 1 of 5, Prepare the System Environment.
#  *
   JOBSTATUS=0
   for textstring in $(cat ENV4SYS1.cfg);
   do
#      # * The following statement will replace all occurences
#      # * of USD_BASESYS1 with the value of the BASESYS1
#      # * environment variable.
       textstring=${textstring//USD_BASESYS1/$BASESYS1}
#      # * The following statement will replace all occurences
#      # * of USD_JOBNAME with the value of the JOBNAME
#      # * environment variable.
       textstring=${textstring/USD_JOBNAME/$JOBNAME}
       export $textstring
       rc=$?
       if [ $rc != 0 ]
       then
          simonote.sh "#  $textstring - Return Code is $rc"
          JOBSTATUS=$rc
       fi
   done
#  *
   simonote.sh "****************************************************************$JOBNAME"
   simonote.sh "# Starting Job Name $JOBNAME"
   simonote.sh "# BASESYS1........... $BASESYS1"
   simonote.sh "# COB_LIBS........... $COB_LIBS"
   simonote.sh "# COB_LIBRARY_PATH... $COB_LIBRARY_PATH"
   simonote.sh "# SIMONOTE........... $SIMONOTE"
   simonote.sh "# Conclude Step 1 of 5, Prepare the System Environment..."
#  *
   simonote.sh "# ------------------------------------------------------------ #"
   simonote.sh "# Continue Step 2 of 5, Convert ZOS_FILE to GNU_FILE..."
#  *
#  * Prepare the environment, map the file names...
   export BSIODSN1=$BASESYS1/SIMOSAM1/DEVL/DATA/FTP1/SIMOTIME.DATA.FTPDDV01.zos
   export SQEDDV01=$BASESYS1/SIMOSAM1/DEVL/DATA/WRK1/SIMOTIME.DATA.SQEDDV01.dat
   export SYSOUT=$BASESYS1/SIMOSAM1/DEVL/LOGS/SYSOUT_VRECEXS1.txt
   simonote.sh "# DATATAKE is $BSIODSN1"
   simonote.sh "# DATAMAKE is $SQEDDV01"
#  *
   if [ -f "$SQEDDV01" ]
   then
      rm $SQEDDV01
   fi
#  *
#  * Execute Conversion Program
   cobcrun VRECEXC1 | tee $SYSOUT
   rc=$?
   if [ $rc != 0 ]
   then
      simonote.sh "# ABENDING $name - Return Code is $rc"
      JOBSTATUS=$rc
   else
      ((AOK_Count++))
   fi
#  *
   simonote.sh "# ------------------------------------------------------------ #"
   simonote.sh "# Continue Step 3 of 5, Physical Hex-Dump of ZOS_FILE..."
#  *
#  * This job step will use the VIEW Function of the SIMOZAPS Utility Program
#  * to provide a Hex-Dump of the file created in the previous job step.
#  *
   export SYSLOG=$BASESYS1/SIMOSAM1/DEVL/LOGS/SYSLOG_SIMOZAPS_ZOS_FILE.txt
   if [ -f "$SYSLOG" ]
   then
      rm $SYSLOG
   fi
   cobcrun SIMOZAPS  HEXCESS $BSIODSN1 view=1    stop=99999
#  *
   simonote.sh "# ------------------------------------------------------------ #"
   simonote.sh "# Continue Step 4 of 5, Physical Hex-Dump of GNU_FILE..."
#  *
#  * This job step will use the VIEW Function of the SIMOZAPS Utility Program
#  * to provide a Hex-Dump of the file created in the previous job step.
#  *
   export SYSLOG=$BASESYS1/SIMOSAM1/DEVL/LOGS/SYSLOG_SIMOZAPS_GNU_FILE.txt
   if [ -f "$SYSLOG" ]
   then
      rm $SYSLOG
   fi
   cobcrun SIMOZAPS  HEXCESS $SQEDDV01 view=1    stop=99999
#  *
   simonote.sh "# ------------------------------------------------------------ #"
   simonote.sh "# Continue Step 5 of 6, Convert GNU_FILE to ASCII/Text ile..."
#  *
#  * Prepare the environment, map the file names...
   export SYSUT1=$BASESYS1/SIMOSAM1/DEVL/DATA/WRK1/SIMOTIME.DATA.SQEDDV01.dat
   export SYSUT2=$BASESYS1/SIMOSAM1/DEVL/DATA/WRK1/SIMOTIME.DATA.LSQDDV01.txt
   export SYSOUT=$BASESYS1/SIMOSAM1/DEVL/LOGS/SYSOUT_VXEL1KC1.txt
   simonote.sh "# DATATAKE is $SYSUT1"
   simonote.sh "# DATAMAKE is $SYSUT2"
#  *
   if [ -f "$DATAMAKE" ]
   then
      rm $DATAMAKE
   fi
#  *
#  * Execute Conversion Program
   cobcrun VXEL1KC1 | tee $SYSOUT
   rc=$?
   if [ $rc != 0 ]
   then
      simonote.sh "# ABENDING $name - Return Code is $rc"
      JOBSTATUS=$rc
   else
      ((AOK_Count++))
   fi
#  *
   simonote.sh "# ------------------------------------------------------------ #"
   simonote.sh "# Continue Step 5 of 5, End of Job Processing..."
#  *
   if [ "$JOBSTATUS" = "0" ]
   then
      simonote.sh "# Finished Job Name $JOBNAME"
   else
      simonote.sh "# ABENDING Job Name $JOBNAME"
   fi

Table of Contents Previous Section Next Section Environment Variables

The following are the environment variables used to influence the behavior of the programs that access the mainframe formatted sequential files with variable length records.

Variable  Description
INITREC1  Must be "A" or "E" to initialize the record area with x"20" or x"40". If not specified the default value is "E".
EXTFH  Points to the EXTFH.CFG file if used. This is an optional environment variable
BSIOFMT1  Identifies the format of the input file. The following are the options for this environment variable.
Keyword Description
Variable, if not specified the default value is 'V".
The four bytes preceding the logical record is the Record Descriptor Word. The content is as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word. 
3-4 Usually low values
VB  Variable Blocked
The four bytes preceding the logical record (Descriptor Word) are as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word. 
3-4 The length of the block including four-byte Descriptor Word.
VBS  Variable Blocked Spanned
The four bytes preceding the logical record is the Segment Descriptor Word. The content is as follows.
Bytes  Description
1-2 This is the length of the logical record plus the length of the four-byte Descriptor Word.
3 Segment Control Codes
Value  Relative position of segment
00 A complete logical record 
01 The first segment of a multiple segments record
02 The last segment of a multiple segments record
03 A middle segment of a multiple segments record
4 Low value, reserved for future use
VO  Variable, override the reasonability check for the RDW
VBO  Variable Blocked, override the reasonability check for the RDW

Note 1: For a mainframe file with variable length, unblocked records each record is preceded by a four byte descriptor word. The first two bytes is a two byte binary value for the record length followed by two bytes of Low Values. By using VO the reasonability check will be bypassed.
Note 2: For a mainframe file with variable length, blocked records each record is preceded by a four byte descriptor word. The first two bytes is a two byte binary value for the record length. The second part is a two byte Block Descriptor Word (BDW). By using VBO the reasonability check will be bypassed.
Note 3: For a mainframe file with variable length, blocked, spanned record segments each record is preceded by a four byte Segment Descriptor Word. The first two bytes is a two byte binary value for the record segment length. The third byte is a segment control code and the fourth byte is a low value or binary 00.

Table of Contents Previous Section Next Section Mapping File Names

The following are the environment variables used to map the file names used by the programs to the actual file names used on the external storage media or hard disk.

 Variable Description
 BSIODSN1 Windows - This is the "drive:directory\filename.ext" for the input file.
This will map the DD name (used by the COBOL programs) to the fully qualified Windows file name.
Linux - This is the "/directory/filename.ext" for the input file.
This will map the DD name (used by the COBOL programs) to the fully qualified Linux file name.
This is the mainframe formatted sequential file with variable length records. This is usually an EBCDIC encoded file and may contain packed or binary data.
 SEQDDV01 Windows - This is the "drive:directory\filename.ext" for the output file.
This will map the DD name (used by the COBOL programs) to the fully qualified Windows file name.
Linux - This is the "/directory/filename.ext" for the output file.
This will map the DD name (used by the COBOL programs) to the fully qualified Linux file name.
This will be a Micro Focus or GnuCOBOL formatted sequential file with variable length records. The content of the records will be the same as the input file. Only the file format is changed in this example.
  Programming Requirements for the File Transfer and Convert Software

Table of Contents Previous Section Next Section Source Code for File Format Conversion Program

A sequential data file with variable length records that is a mirror image of a mainframe formatted file must be converted to a Micro Focus or GnuCOBOL formatted file with variable length records. The file that is a mainframe image cannot be accessed at the record level from a COBOL program using the standard SELECT and FD syntax. Therefore, the byte-stream I/O capabilities provided by Micro Focus or GnuCOBOL will be used to read this file.

The following program (VRECEXC1.cbl) will read the mainframe file by calling the SIMOVREC.CBL program. SIMOVREC.CBL will call SIMOBSIO.CBL to read text strings from the mainframe file and build logical records to pass back to the following program. The following program will then use standard COBOL coding techniques to write the records to a Micro Focus or GnuCOBOL formatted file.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    VRECEXC1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2019 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, 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.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software 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 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                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: VRECEXC1.CBL
      * Copy Files:    PASSRTN1.CPY
      *                ASCEBCB1.CPY
      * Calls to:      SIMOVREC
      *                SIMOBSIO
      *****************************************************************
      *
      *                   ************
      *                   * VRECEXE1 *
      *                   ********cmd*
      *                        *
      *                   ************
      *                   * if exist  *
      *                   ********stmt*
      *                        *
      *  ************     ************     ************
      *  * BSIODSN1 *-----* VRECEXC1 *-----* SQEDDV01 *
      *  ********dat*     ********cbl*     ********dat*
      *                        *   *
      *                        *   *       ************
      *                        *   *--call-* SIMOVREC *
      *                        *           ********cbl*
      *                        *             *
      *                        *             *       ************
      *                        *             *--call-* SIMOBSIO *
      *                        *                     ********cbl*
      *                   ************
      *                   *   EOJ    *
      *                   ************
      *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SQEDDV01-FILE  ASSIGN to     SQEDDV01
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is SQEDDV01-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SQEDDV01-FILE
           DATA RECORD    is SQEDDV01-RECORD
           RECORDING MODE is V
      *    ------------------------------------------------------------
      *    The following may need to be changed to match actual file.
           RECORD is VARYING in SIZE from 4 to 32760
           depending on SQEDDV01-LREC.

       01  SQEDDV01-RECORD.
           05  SQEDDV01-DATA-01  pic X(32760).
      *    The preceding may need to be changed to match actual file.
      *    ------------------------------------------------------------

       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* VRECEXC1 '.
           05  T2 pic X(34) value 'Variable Record Routine v01.00.00 '.
           05  T3 pic X(10) value ' v06.10.23'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* VRECEXC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2019 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* VRECEXC1 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* VRECEXC1 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* VRECEXC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  SQEDDV01-STATUS.
           05  SQEDDV01-STATUS-L     pic X.
           05  SQEDDV01-STATUS-R     pic X.
       01  SQEDDV01-EOF              pic X       value 'N'.
       01  SQEDDV01-OPEN-FLAG        pic X       value 'C'.

       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.

       01  APPL-RESULT             pic S9(9)   comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  SQEDDV01-LREC           pic 9(5)    comp    value 0.
       01  SQEDDV01-LREC-ALPHA     redefines   SQEDDV01-LREC.
           05  VREC-LEN-1          pic X(2).
           05  VREC-LEN-2          pic X(2).

       01  SQEDDV01-LBLK           pic 9(5)    comp    value 0.
       01  SQEDDV01-LBLK-ALPHA     redefines   SQEDDV01-LBLK.
           05  VBLK-LEN-1          pic X(2).
           05  VBLK-LEN-2          pic X(2).

       01  RECORD-LENGTH-DISPLAY.
           05  filler              pic X(15) value 'Record length: '.
           05  RECORD-LENGTH-VALUE pic 9(5)  value 0.

       01  RECORD-MIN-DISPLAY.
           05  filler              pic X(15) value 'Record MIN is: '.
           05  RECORD-MIN-VALUE    pic 9(4)  value 0.

       01  RECORD-MAX-DISPLAY.
           05  filler              pic X(15) value 'Record MAX is: '.
           05  RECORD-MAX-VALUE    pic 9(4)  value 0.

       01  BSIOREAD-TOTAL.
           05  filler      pic X(18)  value 'BSIOREAD count is '.
           05  BSIOREAD-COUNT      pic 9(7) value 0.

       01  BSIOBLOK-TOTAL.
           05  filler      pic X(18)  value 'BSIOBLOK count is '.
           05  BSIOBLOK-COUNT      pic 9(7) value 0.

       01  SQEDDV01-TOTAL.
           05  filler      pic X(18)  value 'SQEDDV01 count is '.
           05  SQEDDV01-COUNT      pic 9(7) value 0.

       COPY PASSVREC.

      *01  PASSVREC-AREA.
      *    05  VREC-REQUEST    pic X(8)        value 'GET     '.
      *    05  VREC-RESPOND    pic 9(4)        value 0.
      *    05  VREC-LENGTH     pic 9(5)        value 0.
      *    05  VREC-BUFFER     pic X(32760)    value SPACES.

      *****************************************************************
       PROCEDURE DIVISION.
           perform GET-STARTED
           perform SQEDDV01-OPEN
           add 80 to ZERO giving SQEDDV01-LREC
           perform until VREC-RESPOND not = ZERO
             call 'SIMOVREC' using PASSVREC-AREA
             if  VREC-RESPOND = ZERO
                 add  VREC-LENGTH to ZERO giving SQEDDV01-LREC
                 move VREC-BUFFER to SQEDDV01-RECORD
                 perform SQEDDV01-WRITE
             end-if
           end-perform

           perform SQEDDV01-CLOSE

           perform Z-THANK-YOU.
           GOBACK.

      *****************************************************************
       GET-STARTED.
           perform Z-POST-COPYRIGHT
           move 'GET     ' to VREC-REQUEST
           move ZERO       to VREC-RESPOND
           move ZERO       to VREC-LENGTH
           move SPACES     to VREC-BUFFER
           exit.

      *****************************************************************
      * I/O ROUTINES FOR SQEDDV01...                                  *
      *****************************************************************
       SQEDDV01-WRITE.
           if  SQEDDV01-OPEN-FLAG = 'C'
               perform SQEDDV01-OPEN
           end-if
           write SQEDDV01-RECORD
           if  SQEDDV01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SQEDDV01-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'SQEDDV01-Failure-WRITE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SQEDDV01-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SQEDDV01-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open output SQEDDV01-FILE
           if  SQEDDV01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SQEDDV01-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SQEDDV01-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SQEDDV01-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SQEDDV01-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SQEDDV01-FILE
           if  SQEDDV01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SQEDDV01-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SQEDDV01-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SQEDDV01-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1    = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* VRECEXC1 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY
           else
               display '* VRECEXC1 File-Status-' IO-STATUS
           end-if
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01
           display SIM-THANKS-02
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Summary

The purpose of this document is to show how to transfer a file from a mainframe using File Transfer Protocol (FTP). The mainframe file is an EBCDIC-encoded, sequential file with variable length records. Once the file is transferred the file format will be converted to a Micro Focus formatted file with variable length records. The content of the records will remain EBCDIC encoded. 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.

Table of Contents Previous Section Next Section 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.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an Internet connection, the second group of documents will require an Internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   Explore the alternatives for transferring data files between systems. This link provides access to a repository of information that includes the transferring and/or sharing of data between Mainframe (ZOS or VSE), Linux, UNIX and Windows Systems.

Link to Internet   Link to Server   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.

Link to Internet   Link to Server   Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an Internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

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 GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

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.

Table of Contents Previous Section Next Section Company Overview

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
Files with Variable Length Records, File Transfer and File Convert
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com