Variable Length Records
SimoVREC - The COBOL Source Code
  Table of Contents  v-16.01.01 - simovrec.htm 
  Introduction
  SIMOVREC, What it Does
  SIMOVREC, How to Use
  The COBOL Source Code
  The COBOL Copy File
  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 primary purpose of the SIMOVREC program is to provide a capability for accessing a mainframe file with variable length records that has been transferred from the mainframe to a Windows platform using "BINARY" mode. This capability will allow a user to read the mainframe formatted file and write to a standard Micro Focus file using variable length records. This document provides a listing of the COBOL source code for viewing. Additional information about this program may be obtained by sending an e-mail to: helpdesk@simotime.com .


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

Table of Contents Previous Section Next Section SIMOVREC, What it Does

The SimoVREC routine (or callable program) will provide access to a mainframe formatted sequential file with variable length records that has been downloaded from a mainframe using the File Transfer Protocol (FTP) in "BINARY" mode.

Table of Contents Previous Section Next Section SIMOVREC, How to Use

The following is an example of how to initialize the pass area. This only needs to be done one time prior to the first call.

           move 'GET     ' to VREC-REQUEST
           move ZERO       to VREC-RESPOND
           move ZERO       to VREC-LENGTH
           move SPACES     to VREC-BUFFER

The following is an example of a call statement for the callable routine.

           call 'SIMOVREC' using PASSVREC-AREA

It is not necessary to do an explicit open of the input, byte-stream file. The first call to the routine will open the file and read the first record. Subsequent calls will return a logical record in the buffer with its record length in the RTN1-LENGTH field. When a call results in an end of file condition the routine will close the file. The COBOL copy file that defines the data structure for the pass area is described in a following section of this document. For convenience the following shows the field layout.

       01  PASSVREC-AREA.
           05  VREC-REQUEST    pic X(8).
           05  VREC-RESPOND    pic 9(4).
           05  VREC-LENGTH     pic 9(5).
           05  VREC-BUFFER     pic X(32760).

The following is a list of the parameters and the required content when using the PASSVREC-AREA to call the SimoVREC routine.

Variable Description
VREC-REQUEST This parameter must be provided by the calling program.
Keyword Description
GET  Get a logical record from a mainframe formatted sequential file with variable length records.
xxx  Reserved for future use.
VREC-RESPOND A zero (0) value indicates a successful completion of the request. A non-zero value indicates the request could not be completed successfully.
VREC-LENGTH The length of the read or GET request is posted in this parameter by SimoVREC. This is the length of the record. The logical record size may be from 4 to 32,760 bytes.
VREC-BUFFER This parameter will contain the logical record for a GET request.
  A List of the Environment Variables used by the SIMOVREC Callable Program

The following are environment variables used by the byte-stream read routine for mainframe formatted files with variable length records.

Variable Description
BSIODSN1 This is the drive:directory\filename.ext for the input file. This will map the DD name to the fully qualified PC file name.
INITREC1 Must be "A" or "E" to initialize the record area with x"20" or x"40". If not specified the default vale is "E".
EXTFH Points to the EXTFH.CFG file if used. Optional 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".
VB  Variable Blocked
VO  Variable, override the reasonability check for the RDW
VBO  Variable Blocked, override the reasonability check for the RDW

Note: For a mainframe file with variable length records each record is preceded by a four byte Record Descriptor Word (RDW) and a possible four byte Block Descriptor Word (BDW).
The first two bytes of the RDW (and possible BDW) contains a binary value that is the length of the record (or possible block).
The second two bytes of the RDW (and possible BDW) usually contain binary zeroes (or x'00').
The reasonability check test to insure the second two bytes are binary zeroes. By using VO or VBO this reasonability check will be bypassed.
  A List of the Environment Variables used by the SIMOVREC Callable Program

Table of Contents Previous Section Next Section The COBOL Source Code

The following (SIMOVREC.cbl) is the COBOL Source Code.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOVREC.
      *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: SIMOVREC.CBL
      * Copy Files:    PASSVREC.CPY  (used in LINKAGE Section)
      *                PASSBSIO.CPY  (used in WORKING-STORAGE Section)
      * Calls to:      SIMOBSIO.CBL
      *****************************************************************
      *
      *                   ************
      *                   * VRECEXE1 *
      *                   ********cmd*
      *                        *
      *                   ************
      *                   * if exist  *
      *                   ********stmt*
      *                        *
      *                   ************     ************
      *                   * VRECEXC1 *-----* SQEDDV01 *
      *                   ********cbl*     ********dat*
      *                        *
      *                        **********
      *                   call *        *
      *                        *        *
      *                   ************  *
      *                   * SIMOVREC *  *
      *                   ********cbl*  *
      *                        *        * End
      *                   call *        * Of
      *                        *        * File
      *  ************     ************  *
      *  * BSIODSN1 *-----* SIMOBSIO *  *
      *  ********dat*     ********cbl*  *
      *                                 *
      *                        **********
      *                        *
      *                   ************
      *                   *   EOJ    *
      *                   ************
      *
      *****************************************************************
      *ENVIRONMENT DIVISION.

      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* SIMOVREC '.
           05  T2 pic X(34) value 'File Reader via Byte-Stream I/O   '.
           05  T3 pic X(10) value ' v11.08.23'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* SIMOVREC '.
           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 '* SIMOVREC '.
           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 '* SIMOVREC '.
           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'.

      *****************************************************************
      *    Message Buffer used for display to SYSOUT or CONSOLE.
      *    MB-LSB, Last Significant Byte in Message Buffer
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(011)  value '* SIMOVREC '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MB-LSB                  pic 9(3)    value 267.

      *****************************************************************
      *    Data-structure for environment variable get routine...     *
      *****************************************************************
       01  ENV-VAR-NAME            pic X(16)   value SPACES.
       01  ENV-VAR-VALUE           pic X(256)  value SPACES.

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

       01  DEBUG-LEVEL             pic 9(2)    value 0.
       01  FIRST-TIME              pic X       value 'Y'.
       01  BSIO-OPEN-FLAG          pic X       value 'N'.

       01  FILE-TYPE               pic X(3)    value 'V  '.
       01  DW-EDIT                 pic X       value 'Y'.
       01  DW-EXPECTED             pic X       value LOW-VALUES.

       01  INITREC1-MESSAGE.
           05  FILLER              pic X(12)   value 'InitREC1 is '.
           05  OUTPUT-ENCODING     pic X       value 'E'.

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

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

       01  VBS-LOOP                pic 9(9)    comp    value 0.
       01  VBS-LOOP-ALPHA          redefines   VBS-LOOP.
           05  VBS-LOOP-1          pic X.
           05  VBS-LOOP-2          pic X.
           05  VBS-LOOP-3          pic X.
           05  VBS-LOOP-4          pic X.

       01  OT-X1                   pic 9(7)    value 0.

       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  VREDBV01-TOTAL.
           05  filler      pic X(18)  value 'VREDBV01 count is '.
           05  VREDBV01-COUNT      pic 9(7) value 0.

      *****************************************************************
      * The following copy file is the pass area for calling SIMOBSIO,
      * the byte stream I/O routine.
      *****************************************************************
      *
       COPY PASSBSIO.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSVREC.

      *****************************************************************
       PROCEDURE DIVISION using PASSVREC-AREA.
           if  FIRST-TIME = 'Y'
               perform GET-STARTED
      *        perform BSIO-OPEN
               move 'N' to FIRST-TIME
               move ZERO to PSIO-OFFSET
           end-if

           if  OUTPUT-ENCODING = 'E'
               move all x'40' to VREC-BUFFER
           else
               move all x'20' to VREC-BUFFER
           end-if

           if  BSIO-OPEN-FLAG not = 'Y'
               if  VREC-REQUEST = 'GET     '
               or  VREC-REQUEST = 'READBSIO'
                   perform BSIO-OPEN
               end-if
           end-if

           evaluate VREC-REQUEST
             when 'GET     ' if  FILE-TYPE = 'VBS'
                                 perform BSIO-READ-VREC-MULTIPLE
                             else
                                 perform BSIO-READ-VREC
                             end-if
             when 'READBSIO' if  FILE-TYPE = 'VBS'
                                 perform BSIO-READ-VREC-MULTIPLE
                             else
                                 perform BSIO-READ-VREC
                             end-if
             when 'OPEN    ' perform BSIO-OPEN
             when 'OPENPUT ' perform BSIO-OPEN
             when 'CLOSE   ' perform BSIO-CLOSE
             when 'CREATE  ' perform BSIO-CREATE
             when other      add 16 to ZERO giving PSIO-RETURN
                             add 16 to ZERO giving VREC-RESPOND
           end-evaluate

           if  PSIO-RETURN = ZERO
               evaluate FILE-TYPE
                 when  'V  ' perform ACTION-FOR-V
                 when  'VB ' perform ACTION-FOR-VB
                 when  'VBS' perform ACTION-FOR-VBS
                 when other  add 9301 to ZERO giving VREC-RESPOND
               end-evaluate
           else
               add  PSIO-RETURN to ZERO giving VREC-RESPOND
           end-if

           GOBACK.

      *****************************************************************
       ACTION-FOR-V.
           add  PSIO-LENGTH to ZERO      giving VREC-LENGTH
           move PSIO-BUFFER(1:VREDBV01-LREC)
             to VREC-BUFFER(1:VREDBV01-LREC)
           add  PSIO-RETURN to ZERO giving VREC-RESPOND
           exit.

      *****************************************************************
       ACTION-FOR-VB.
           add  PSIO-LENGTH to ZERO      giving VREC-LENGTH
           move PSIO-BUFFER(1:VREDBV01-LREC)
             to VREC-BUFFER(1:VREDBV01-LREC)
           add  PSIO-RETURN to ZERO giving VREC-RESPOND

      *    if  FILE-TYPE = 'VB '
      *        move BSIOBLOK-TOTAL to MESSAGE-TEXT
      *        perform Z-DISPLAY-CONSOLE-MESSAGE
      *    end-if
           exit.

      *****************************************************************
       ACTION-FOR-VBS.
           add  PSIO-RETURN to ZERO giving VREC-RESPOND
           exit.

      *****************************************************************
      * I/O ROUTINES FOR BYTE-Stream I/O...                           *
      *****************************************************************
       BSIO-READ-VREC.
      *    Get the Block Descriptor Word (BDW)...
           if  FILE-TYPE = 'VB'
           and VREDBV01-LBLK < 1
               add 4 to ZERO giving PSIO-LENGTH
               move 'READBSIO' to PSIO-REQUEST
               call 'SIMOBSIO' using PSIO-PASS-AREA
               if  DW-EDIT = 'Y'
                   if  PSIO-BUFFER(3:2) not = LOW-VALUES
                       move 'Invalid Block Descriptor Word'
                         to MESSAGE-TEXT
                       perform Z-ABEND-PROGRAM
                   end-if
               end-if
               move PSIO-BUFFER(1:2) to VREDBV01-LBLK-ALPHA(3:2)
               subtract 4 from  VREDBV01-LBLK
               add 4 to PSIO-OFFSET
               add 1 to BSIOBLOK-COUNT
           end-if

      *    Get the Record Descriptor Word (RDW)...
           add 4 to ZERO giving PSIO-LENGTH
           move 'READBSIO' to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA
           if  PSIO-RETURN = 0
               if  DW-EDIT = 'Y'
                   if  PSIO-BUFFER(3:2) not = LOW-VALUES
      *                For VBS this will post an error if a record
      *                attempts to span segments.
                       move 'Invalid Descriptor Word Content'
                         to MESSAGE-TEXT
                       perform Z-ABEND-PROGRAM
                   end-if
               end-if
               move PSIO-BUFFER(1:2) to VREDBV01-LREC-ALPHA(3:2)
               if  FILE-TYPE = 'VB'
                   subtract VREDBV01-LREC from  VREDBV01-LBLK
               end-if
               subtract 4 from  VREDBV01-LREC
      *        Read the variable-length record.
               add PSIO-LENGTH to PSIO-OFFSET
               add  VREDBV01-LREC to ZERO giving PSIO-LENGTH
               if  PSIO-LENGTH > PSIO-MAX-SIZE
                   add PSIO-MAX-SIZE to ZERO giving VREDBV01-LREC
                   display 'Record read size exceeds max size '
                           PSIO-LENGTH ' vs ' PSIO-MAX-SIZE
                           ' Record Number is ' BSIOREAD-COUNT
                           upon console
               end-if
               call 'SIMOBSIO' using PSIO-PASS-AREA
               add 1 to BSIOREAD-COUNT
               add PSIO-LENGTH to PSIO-OFFSET
           end-if
           exit.

      *---------------------------------------------------------------*
       BSIO-READ-VREC-MULTIPLE.
           move x'01' to VBS-LOOP-3
           move ZERO to VREC-LENGTH
           add 1 to ZERO giving OT-X1
           perform until VBS-LOOP-3 = LOW-VALUE
                      or VBS-LOOP-3 = x'02'
             perform BSIO-READ-VREC-MULTIPLE-02
             if  PSIO-RETURN = 0
                 add  PSIO-LENGTH to VREC-LENGTH
                 move PSIO-BUFFER(OT-X1:VREDBV01-LREC)
                   to VREC-BUFFER(OT-X1:VREDBV01-LREC)
                 add  PSIO-LENGTH to OT-X1
             end-if
           end-perform
           exit.

      *---------------------------------------------------------------*
       BSIO-READ-VREC-MULTIPLE-02.
      *    Get the Segment Descriptor Word (RDW)...
           add 4 to ZERO giving PSIO-LENGTH
           move 'READBSIO' to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA
           if  PSIO-RETURN = 0
               move PSIO-BUFFER(1:4) to VBS-LOOP-ALPHA
               if  DW-EDIT = 'Y'
                   if  VBS-LOOP-3 not = LOW-VALUE
                   and VBS-LOOP-3 not = x'01'
                   and VBS-LOOP-3 not = x'02'
                   and VBS-LOOP-3 not = x'03'
      *                For VBS this will post an error if a record
      *                attempts to span segments.
                       move 'Invalid Descriptor Word Content'
                         to MESSAGE-TEXT
                       perform Z-ABEND-PROGRAM
                   end-if
               end-if
               move PSIO-BUFFER(1:2) to VREDBV01-LREC-ALPHA(3:2)
               subtract 4 from  VREDBV01-LREC
      *        Read the variable-length record.
               add PSIO-LENGTH to PSIO-OFFSET
               add  VREDBV01-LREC to ZERO giving PSIO-LENGTH
               if  PSIO-LENGTH > PSIO-MAX-SIZE
                   add PSIO-MAX-SIZE to ZERO giving VREDBV01-LREC
                   display 'Record read size exceeds max size '
                           PSIO-LENGTH ' vs ' PSIO-MAX-SIZE
                           ' Record Number is ' BSIOREAD-COUNT
                           upon console
               end-if
               call 'SIMOBSIO' using PSIO-PASS-AREA
               add 1 to BSIOREAD-COUNT
               add PSIO-LENGTH to PSIO-OFFSET
           else
               move LOW-VALUE to VBS-LOOP-3
           end-if
           exit.


      *---------------------------------------------------------------*
       BSIO-OPEN.
           move PSIO-FILENAME to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE

           move 'OPEN    ' to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA

           if  PSIO-RETURN = 0
               move 'AOK, OPEN Input File for BSIO'  to MESSAGE-TEXT
               move 'Y' to BSIO-OPEN-FLAG
           else
               move 'NOK, OPEN Input File FAILURE '  to MESSAGE-TEXT
               add  PSIO-RETURN to ZERO giving VREC-RESPOND
               perform Z-ABEND-PROGRAM
           end-if
           perform Z-DISPLAY-CONSOLE-MESSAGE

           move 'FILEINFO' to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA

           if  PSIO-RETURN = 0
               move 'AOK, File Info Request for BSIO'  to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move PSIO-FILE-SIZE to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
           else
               move 'NOK, File Info Request FAILURE '  to MESSAGE-TEXT
               perform Z-ABEND-PROGRAM
           end-if

           exit.

      *---------------------------------------------------------------*
       BSIO-CREATE.
           move PSIO-FILENAME to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE

           move VREC-REQUEST to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA

           if  PSIO-RETURN = 0
               move 'AOK, CREATE File for BSIO'  to MESSAGE-TEXT
           else
               move 'NOK, CREATE File FAILURE '  to MESSAGE-TEXT
               perform Z-ABEND-PROGRAM
           end-if
           perform Z-DISPLAY-CONSOLE-MESSAGE

           exit.

      *---------------------------------------------------------------*
       BSIO-CLOSE.
           move 'CLOSE   ' to PSIO-REQUEST
           call 'SIMOBSIO' using PSIO-PASS-AREA
           exit.

      *****************************************************************
      * Get an environment variable.                                  *
      *****************************************************************
       GET-ENVIRONMENT-VARIABLE.
           move SPACES to ENV-VAR-VALUE
           move ZERO to RETURN-CODE
           accept  ENV-VAR-VALUE from ENVIRONMENT ENV-VAR-NAME
                   on exception add 8 to ZERO giving RETURN-CODE
           end-accept
           if  RETURN-CODE not = 0
               move SPACES to ENV-VAR-VALUE
           end-if
           exit.

      *****************************************************************
      * Get started or first time logic...                            *
      *****************************************************************
       GET-STARTED.
           perform Z-POST-COPYRIGHT
      *    Get the fully qualified File Name
           move SPACES     to ENV-VAR-NAME
           move 'BSIODSN1' to ENV-VAR-NAME
           perform GET-ENVIRONMENT-VARIABLE
           if  ENV-VAR-VALUE not = SPACES
               move ENV-VAR-VALUE to PSIO-FILENAME
           else
               move 'Invalid file name for BSIO Function'
                 to MESSAGE-TEXT
               perform Z-ABEND-PROGRAM
           end-if
      *    Get the record initialization value
           move SPACES     to ENV-VAR-NAME
           move 'INITREC1' to ENV-VAR-NAME
           perform GET-ENVIRONMENT-VARIABLE
           if  ENV-VAR-VALUE not = SPACES
               move ENV-VAR-VALUE to OUTPUT-ENCODING
               if  OUTPUT-ENCODING = 'E' or 'A'
                   move INITREC1-MESSAGE  to MESSAGE-TEXT
                   perform Z-DISPLAY-CONSOLE-MESSAGE
               else
                   move 'E' to OUTPUT-ENCODING
                   move 'Invalid INITREC1, not A or E, assumed EBCDIC'
                     to MESSAGE-TEXT
                   perform Z-DISPLAY-CONSOLE-MESSAGE
               end-if
           else
               move 'E' to OUTPUT-ENCODING
               move 'Invalid INITREC1, must be A or E, assumed EBCDIC'
                 to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
      *    Get a possible EXTFH value...
           move SPACES     to ENV-VAR-NAME
           move 'EXTFH   ' to ENV-VAR-NAME
           perform GET-ENVIRONMENT-VARIABLE
           if  ENV-VAR-VALUE not = SPACES
               move ENV-VAR-VALUE to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
           else
               move 'Info Only, EXTFH Environment variable not found.'
                 to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
      *    Get the File Format, should be V or VB
           move SPACES     to ENV-VAR-NAME
      *    move 'BSIOFMT1' to ENV-VAR-NAME
           move 'BSIOFMT1' to ENV-VAR-NAME
           perform GET-ENVIRONMENT-VARIABLE
           inspect ENV-VAR-VALUE converting 'bov' to 'BOV'
           if  ENV-VAR-VALUE = 'VO '
               move 'N' to DW-EDIT
               move 'V  ' to ENV-VAR-VALUE
           end-if
           if  ENV-VAR-VALUE = 'VBO'
               move 'N' to DW-EDIT
               move 'VB ' to ENV-VAR-VALUE
           end-if
           if  ENV-VAR-VALUE = 'V  '
           or  ENV-VAR-VALUE = 'VB '
           or  ENV-VAR-VALUE = 'VBS'
               move ENV-VAR-VALUE to FILE-TYPE
           else
               move 'V  ' to FILE-TYPE
               move 'File Format must be V or VB, assumed V'
                 to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'Info Only, File Type is &&&' to MESSAGE-TEXT
           inspect MESSAGE-TEXT replacing first '&&&' by FILE-TYPE
           perform Z-DISPLAY-CONSOLE-MESSAGE

           add 32760 to ZERO giving PSIO-MAX-SIZE

           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
           GOBACK
      *    STOP RUN
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           perform Z-CALCULATE-MSG-LENGTH
           display MESSAGE-BUFFER(1:MB-LSB) upon console
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-CALCULATE-MSG-LENGTH.
           add 267 to ZERO giving MB-LSB
           if  MESSAGE-TEXT-2 = SPACES
               add 79 to ZERO giving MB-LSB
           else
               if  MESSAGE-BUFFER(122:146) = SPACES
                   subtract 146 from MB-LSB
               end-if
           end-if
           perform until MB-LSB < 80
                      or MESSAGE-BUFFER(MB-LSB:1) not = SPACE
             if  MESSAGE-BUFFER(MB-LSB:1) = SPACE
                 subtract 1 from MB-LSB
             end-if
           end-perform
           exit.

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

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           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 The COBOL Copy File

The following (PASSVREC.cpy) is the COBOL copy file used to define the pass area structure when calling the SIMOVREC program.

      *****************************************************************
      *                PASSVREC is a COBOL Copy File                  *
      *     Data Structure or Pass Area used for calling SIMOVREC.    *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
      * VREC-REQUEST - This parameter must be provided by the calling
      *                program.
      * VREC-RESPOND - A zero (0) value indicates a successful
      *                completion of the request. A non-zero value
      *                indicates the request could not be completed
      *                successfully.
      * VREC-LENGTH  - The length of the read or GET request is posted
      *                in this parameter by SimoVREC. This is the
      *                length of the record. The logical record size
      *                may vary from 4 to 32,760 bytes.
      * VREC-BUFFER  - This parameter will contain the logical record
      *                for a GET request.
      *
       01  PASSVREC-AREA.
           05  VREC-REQUEST    pic X(8).
           05  VREC-RESPOND    pic 9(4).
           05  VREC-LENGTH     pic 9(5).
           05  VREC-BUFFER     pic X(32760).
      *
      ***  PASSVREC - End-of-Copy File - - - - - - - - - - - PASSVREC *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

The primary purpose of the SIMOVREC program is to provide a capability for accessing a mainframe file with variable length records that has been transferred from the mainframe to a Windows platform using "BINARY" mode. This document may be used 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 document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The 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 send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

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 COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore a complete list of the SimoTime Callable Routines or Utility Programs. This includes the callable routines and utility programs for the Micro Focus environment.

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 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 and services available from Micro Focus. This link requires 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 copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

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 at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

Also, check the web site at http://www.simotime.com


Return-to-Top
Access a Variable Length File using COBOL
Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com