The -INC Statement A Function of CA-LIBRARIAN |
The SimoTime Home Page |
The -INC statement is supported for the Micro Focus COBOL environment by using the LIBRARIAN"2" compiler directive. However, the CP and Preprocessor technology used with ORACLE requires the -INC to be changed to a standard COPY or EXEC SQL INCLUDE. A global conversion utility program (ALTINCC1.cbl) may be used to replace the -INC statements with standard COBOL COPY statements. A Windows command file is used to automate the process. Refer to ALTINCE1.cmd for more information.
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-2025
SimoTime Technologies and Services
All Rights Reserved
This section will focus on the primary CMD and CBL files that do the actual processing of the COBOL Source Members that contain the -INC Statements.. The primary CMD File will call other command files to perform ancillary tasks. These secondary command files and programs will be described in the Ancillary Functionality section of this document.
The following shows the logic flow for the scan and replace process.
Color Associations: The Source Code Example, Input & ResultsThis section describes the source code before and after the scan and replace processing. Using -INC StatementsThe following shows the COBOL source code that contains the -INC statements. ***************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. ALTINCU1. *AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * The -INC statement is supported for the Micro Focus COBOL * environment by using the LIBRARIAN2 compiler directive. * However, the CP and Preprocessor technology used with * ORACLE requires the -INC to be changed to a standard COPY * or EXEC SQL INCLUDE. * * For more information about the -INC statement refer to * http://www.simotime.com/altinc01.htm ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* ALTINCU8 '. 05 T2 pic X(34) value 'From -INC to COBOL Copy File Stmt '. 05 T3 pic X(10) value ' v08.06.05'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* ALTINCU8 '. 05 C2 pic X(20) value 'Copyright 1987-2018 '. 05 C3 pic X(28) value ' SimoTime Technologies '. 05 C4 pic X(20) value ' All Rights Reserved'. ***************************************************************** -INC ALTINCB1 -INC ALTINCB2 * Second Include Statement -INC ALTINCB3 **** * Third Include Statement with a line overflow ***************************************************************** PROCEDURE DIVISION. DISPLAY SIM-TITLE DISPLAY SIM-COPYRIGHT * MOVE 'Data Item 001...' to ALTINCB1-DATA DISPLAY ALTINCB1-RECORD MOVE 'Data Item 002...' to ALTINCB2-DATA DISPLAY ALTINCB2-RECORD MOVE 'Data Item 003...' to ALTINCB3-DATA DISPLAY ALTINCB3-RECORD GOBACK. Using Standard COBOL Copy StatementsThe following shows the COBOL source code that is created by the scan and replace process and contains standard COBOL COPY statements. ***************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. ALTINCU1. *AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * The -INC statement is supported for the Micro Focus COBOL * environment by using the LIBRARIAN2 compiler directive. * However, the CP and Preprocessor technology used with * ORACLE requires the -INC to be changed to a standard COPY * or EXEC SQL INCLUDE. * * For more information about the -INC statement refer to * http://www.simotime.com/altinc01.htm ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* ALTINCU8 '. 05 T2 pic X(34) value 'From -INC to COBOL Copy File Stmt '. 05 T3 pic X(10) value ' v08.06.05'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* ALTINCU8 '. 05 C2 pic X(20) value 'Copyright 1987-2018 '. 05 C3 pic X(28) value ' SimoTime Technologies '. 05 C4 pic X(20) value ' All Rights Reserved'. ***************************************************************** COPY ALTINCB1. COPY ALTINCB2. COPY ALTINCB3. ***************************************************************** PROCEDURE DIVISION. DISPLAY SIM-TITLE DISPLAY SIM-COPYRIGHT * MOVE 'Data Item 001...' to ALTINCB1-DATA DISPLAY ALTINCB1-RECORD MOVE 'Data Item 002...' to ALTINCB2-DATA DISPLAY ALTINCB2-RECORD MOVE 'Data Item 003...' to ALTINCB3-DATA DISPLAY ALTINCB3-RECORD GOBACK. The following shows the COBOL source code that is created by the scan and replace process. This example shows the comments from the original -INC statements preceding the standard COBOL COPY statements. ***************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. ALTINCU8. *AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * The -INC statement is supported for the Micro Focus COBOL * environment by using the LIBRARIAN2 compiler directive. * However, the CP and Preprocessor technology used with * ORACLE requires the -INC to be changed to a standard COPY * or EXEC SQL INCLUDE. * * For more information about the -INC statement refer to * http://www.simotime.com/altinc01.htm ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. COPY ALTINCB1. * * Second Include Statement COPY ALTINCB2. * **** * Third Include Statement with a line overflow COPY ALTINCB3. ***************************************************************** PROCEDURE DIVISION. MOVE 'Data Item 001...' to ALTINCB1-DATA DISPLAY ALTINCB1-RECORD MOVE 'Data Item 002...' to ALTINCB2-DATA DISPLAY ALTINCB2-RECORD MOVE 'Data Item 003...' to ALTINCB3-DATA DISPLAY ALTINCB3-RECORD GOBACK. CMD MembersThree (3) CMD members are provided with this suite of programs. Do a Scan & Replace using a List FileThe following is the Windows Command file (ALTINCE1.cmd) that will process COBOL Source Members based on the content of a list file. The actual scan and replace function for the individual members is accomplished by a called CMD File (ALTINCEZ.CMD). @echo OFF rem * ******************************************************************* rem * ALTINCE1.cmd - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2019 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ******************************************************************* rem * This procedure calls the following Windows Command Files. rem * 1. ENV1BASE.cmd - provides a single point for setting commonly rem * used environment variables. rem * 2. SIMONOTE.cmd - provides a consistent process for displaying rem * messages to the screen and writing to a journal rem * or log file. rem * ******************************************************************* call ..\Env1Base set CmdName=ALTINCE1 set JobStatus=0000 rem * call SIMONOTE "*******************************************%CmdName%.cmd" call SIMONOTE "Starting JobName %CmdName%.cmd" rem * rem * Set the environment variable to use the default directives file. set DIRGET=%BaseLib1%\DATA\Wrk1 set DIRPUT=%BaseLib1%\DATA\Wrk2 set DIRLIST=%BaseLib1%\DATA\Wrk1\SIMOTIME.WORK.ALTINCL1.LST rem * echo ALTINCT1.CBL >%DIRLIST% rem * set AOK_Count=0 set NOK_Count=0 rem * rem * FLAG-01 Y = Place Idendifier in position 01, ALTINC rem * FLAG-02 Y = Place Identifier in position 73, ALT-INC rem * FLAG-03 Y = Retain comment information from -INC Statement rem * FLAG-** Remaining flags are reserved for future use rem * set ALTINCBF=NNYNNNNN/NNNNNNNN for /F %%i in (%DIRLIST%) do call ALTINCEZ %%i rem * call SIMONOTE "AOKcount Compile Count for AOK is %AOK_Count% " call SIMONOTE "NOKcount Compile Count for NOK is %NOK_Count% " call SIMONOTE "Finished JobName %CmdName%.cmd RC=%JobStatus%" if not "%SimoGENS%" == "BATCH" pause Callable Member for Single Scan & ReplaceThe following is a callable Windows Command file (ALTINCEZ.cmd) that will process a single COBOL Source Member based on the name in the first parameter. rem * ******************************************************************* rem * ALTINCEZ.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 * It is the callers reponsibility to set the following environment rem * variable prior to calling the command. rem * 1. DIRGET - point to the base directory. This procedure uses rem * various sub-directories under the base directory. rem * 2. DIRPUT - point to the target directory. rem * rem * The following parameters are received from the a command file. rem * Parameter Description rem * --------- -------------------------------------------------------- rem * 1. Name of source member rem * ******************************************************************* set CmdStatus=0000 set COBOLGET=%DIRGET%\%1 set COBOLPUT=%DIRPUT%\%1 run ALTINCC1 if not "%ERRORLEVEL%" == "0" set CmdStatus=0010 if not "%CmdStatus%" == "0000" goto EOJNOK rem * ******************************************************************* :EOJAOK set /A AOK_Count=%AOK_Count% + 1 call SIMONOTE "Complete ALTINCEZ, RC=%Compile2GNTStatus%, PGM=%1" goto :End rem * rem * ******************************************************************* :EOJNOK set JobStatus=0016 set /A NOK_Count=%NOK_Count% + 1 call SIMONOTE "ABENDING ALTINCEZ, RC=%CmdStatus%, PGM=%1, !!!ABENDING!!!" echo %1 - Error during Conversion, refer to %BaseLib1%\LOGS Directory>%BaseLib1%\LOGS\%1.ERR goto :End rem * rem * ******************************************************************* :End Create COBOL Code, use -INC StatementsThe following is a Windows Command file (ALTINCE2.cmd) that will create a single COBOL Source Member that contains -INC statements for testing purposes. @echo OFF rem * ******************************************************************* rem * ALTINCE2.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 - Create a Sequential Data Set on disk using ECHO Command. rem * Author - SimoTime Technologies rem * Date = January 24, 1996 rem * rem * The first job step (DeleteTEXT) will delete any previously created rem * files. rem * The second job step (CreateTEXT) will create a new ASCII/Text file. rem * The third step will convert the Line Sequential file to a Record rem * Sequential file. rem * rem * This set of programs will run on a Personal Computer with Windows rem * and Micro Focus Net Express. rem * set CmdName=ALTINCE2 call ..\ENV1BASE %CmdName% if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG rem * call SIMONOTE "*******************************************************%CmdName%" call SIMONOTE "Starting CmdName %CmdName%, User is %USERNAME%" call SIMONOTE "StepInfo Delete previously created files" set ALTINCT2=%BaseLib1%\DATA\WRK1\ALTINCT1.CBL rem * rem * ******************************************************************* rem * Step 1 of 1, Create and populate a new ASCII/TEXT file... rem * call SIMONOTE "StepInfo Create an ASCII/Text File" if exist %ALTINCT2% del %ALTINCT2% rem * :....1....:....2....:....3....:....4....:....5....:....6....:....7. echo *****************************************************************>>%ALTINCT2% echo IDENTIFICATION DIVISION. >>%ALTINCT2% echo PROGRAM-ID. ALTINCT1. >>%ALTINCT2% echo AUTHOR. SIMOTIME TECHNOLOGIES. >>%ALTINCT2% echo *****************************************************************>>%ALTINCT2% echo DATA DIVISION. >>%ALTINCT2% echo WORKING-STORAGE SECTION. >>%ALTINCT2% echo -INC ALTINCB1 >>%ALTINCT2% echo -INC ALTINCB2 * Second Include Statement >>%ALTINCT2% echo -INC ALTINCB3 **** * Third Include Statement with a line overflow >>%ALTINCT2% echo PROCEDURE DIVISION. >>%ALTINCT2% echo DISPLAY ALTINCB1-RECORD >>%ALTINCT2% echo DISPLAY ALTINCB2-RECORD >>%ALTINCT2% echo DISPLAY ALTINCB3-RECORD >>%ALTINCT2% echo GOBACK. >>%ALTINCT2% if exist %ALTINCT2% call SIMONOTE "DataMake %ALTINCT2%" if not exist %ALTINCT2% set JobStatus=9001 if not %JobStatus% == 0000 goto :EojNok rem * :EojAok call SIMONOTE "Finished CmdName %CmdName%, Job Status is %JobStatus% " goto :End :EojNok call SIMONOTE "NOTE ABENDING CmdName %CmdName%, Job Status is %JobStatus% " :End if not "%1" == "nopause" pause Ancillary FunctionalityThis section provides additional detail about the secondary CMD files and programs that are used in this set of sample programs. Setting the EnvironmentA command file (ENV1BASE.cmd) is called from other command files to set commonly used environment variables. This provides a single point of definition. The following is a listing of the contents of the command file. @echo OFF rem * ******************************************************************* rem * ENV1BASE.cmd - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2021 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ******************************************************************* rem * rem * Text - Provide a single point to set common environment variables. rem * Author - SimoTime Technologies rem * Date - January 24, 1996 rem * rem * Set the commonly used environment variables. This is used to provide rem * a single point for managing the commonly used environment variables. rem * set SimoLIBR=c:\SimoLIBR set BASELIB1=c:\SIMOSAM1\DEVL set BASELIB8=c:\SimoSAM8 set BaseWIP1=c:\SimoSAM1\WIP1 set DATAZERO=c:\SIMODATA\DEVL\DATA\ZERO set BASEAPP=%BaseLib1% set BASESYS=%BaseLib1%\SYS1 set BASECAT=%BaseLib1%\DATA set UMAPALIB=%BASECAT%\ASC1 set UMAPELIB=%BASECAT%\EBC1 set SYSLOG=%BASESYS%\LOGS\SYSLOG_USER.DAT set SYSOUT=%BASEAPP%\LOGS\SYSOUT_SIMSAM01.txt set SLZMSG=%BASEAPP%\LOGS\SLZMSG_USER.TXT set PostNOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.TXT set SIMONOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.txt set USERPOST=%BASEAPP%\LOGS\ASSIGNED_USER_POST_FILE.txt if [%1]==[] goto NO_POST set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%1.txt call SIMONOTE "+ ENV1BASE *" call SIMONOTE "+ ENV1BASE ********************************************************************%1" call SIMONOTE "+ ENV1BASE is preparing the System Environment..." call SIMONOTE "+ SIMOLIBR is %SIMOLIBR%" call SIMONOTE "+ MIFOSYS1 is %MIFOSYS1%" call SIMONOTE "+ BASELIB1 is %BASELIB1%" :NO_POST call SIMONOTE "+ SIMONOTE Job Log File is %SIMONOTE% " rem * set MQBASE=C:\Program Files\IBM\WebSphere MQ rem * rem * Set the location for the Apache-Tomcat Server... set CATALINA_HOME=C:\APACHETC\apache-tomcat-7.0.52 rem set CATALINA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_112 rem * rem * Set the Environment for the Java Environment... rem set JAVABASE=C:\APACHETC\apache-tomcat-7.0.52 set JAVABASE=C:\Program Files (x86)\Java\jdk1.8.0_112 set JAVASDK="%JAVABASE%\bin" set JAVA_HOME=%JAVABASE% set JRE_HOME=%JAVABASE% set SIMOTCAT=%CATALINA_HOME%\webapps\simotcat set SIMPACKS=%CATALINA_HOME%\webapps\simotcat\WEB-INF\classes\simpacks rem * rem * Set the environment for the Micro Focus technology... set MIFOEDEV=C:\Program Files (x86)\Micro Focus\Enterprise Developer set MIFOVCBL=C:\Program Files (x86)\Micro Focus\Visual COBOL Build Tools set MIFOESTU=C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0 set MIFOEMFE="C:\Program Files (x86)\Micro Focus\Mainframe Express" rem * rem * Large file support, performance tuning and record locking of the File Handler set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG rem * rem * For IMS Support set ES_IMSLIB=%BASEAPP%\IMSLIB set ES_ACBLIB=%BASEAPP%\IMSLIB rem * rem * EZASOKETS Check EZASOKETS Enabled box or set ES_EZASOKET_SUPPORT=YES set EZACONFG=BASESYS1\CONFIG\EZACONFG.dat rem * rem * Resource Allocation and Performance for SORT and non-Relational Data rem set MFJSENGINE=SYNCSORT set SORTSCHEME=1 set SORTSPACE=750000000 set TMP=C:\SORTWORK rem * set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg rem * For CORE_ON_ERROR function, ABEND Dump rem * set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg rem * rem * Consolidated Trace Facility (CTF) rem * set MFTRACE_CONFIG=%BASESYS%\CONFIG\ctf.cfg rem * set MFTRACE_LOGS=c:\ctflogs rem * rem * For Job Restart, ABEND Recovery set MF_UCC11=Y set ES_JES_RESTART=Y rem * rem * Set environment for MFBSI (Micro Focus Batch Scheduling Interface) set ES_EMP_EXIT_1=mfbsiemx set MFBSI_DIR=%BASESYS%\LOGS\%JESSERVERNAME% set MFBSIEOP_CMD=ENABLE set MFBSIEOP_CSV=ENABLE set MFBSIEOP_HTM=ENABLE set MFBSIEOP_XML=ENABLE rem * rem * Set Behavior and Trace Flags for GETJOBDD rem * Position=12345678/12345678 set JDDFLAGS=nnnWnnnn/YYnnnnnn rem * rem * If not already set then set the PATH for Micro Focus Directories if "%SIMOPATH%" == "Y" goto JUMPPATH if "%MIFOSYS1%" == "EDEV" goto JUMPEDEV if "%MIFOSYS1%" == "VCBL" goto JUMPVCBL if "%MIFOSYS1%" == "ESTU" goto JUMPESTU if "%MIFOSYS1%" == "EMFE" goto JUMPEMFE :JUMPEDEV set path=%BASESYS%\LOADLIB;%MIFOEDEV%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOEDEV%\CPYLIB set MIFOBASE=%MIFOEDEV% goto JUMPPATH :JUMPVCBL set path=%MIFOVCBL%\bin;%MIFOVCBL%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set MIFOBASE=%MIFOVCBL% goto JUMPPATH :JUMPESTU set MIFOBASE=%MIFOESTU%\Base set MIFOBIN=%MIFOBASE%\bin set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE goto JUMPPATH :JUMPEMFE set MIFOBASE=%MIFOEMFE%\Base set MIFOBIN=%MIFOBASE%\bin set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE goto JUMPPATH rem * :JUMPPATH set SIMOPATH=Y rem * set MAINFRAME_FLOATING_POINT=true set COBIDY=%BASEAPP%\COBIDY set COBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR% set LIBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR% set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE% set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR% rem * set USERCLASS=%BASELIB1%\LOADLIB set CLASSPATH=. set CLASSPATH=%CLASSPATH%;%JAVABASE% set CLASSPATH=%CLASSPATH%;%JAVABASE%\lib set CLASSPATH=%CLASSPATH%;\%USERCLASS%\simpacks set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes\simpacks rem * if "%MIFOSYS1%" == "ESTU" set CLASSPATH=%CLASSPATH%;%MIFOBIN% if "%MIFOSYS1%" == "EDEV" set CLASSPATH=%CLASSPATH%;%MIFOEDEV% if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL% if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%\bin\mfcobol.jar rem * set JobStatus=0000 call SIMONOTE "+ ENV1BASE is returning to caller" Display & Log MessagesThe following is a listing of the contents of the (SIMONOTE.cmd) command file. @echo OFF rem * ******************************************************************* rem * SIMONOTE.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 - Display message on screen and write to a log file. rem * Author - SimoTime Technologies rem * rem * This script may be called from other scripts and expects a single rem * parameter enclosed in double quotes. The double quotes will be rem * removed. Before writing to the log file a date and time stamp rem * will be inserted in front of the message text. rem * rem * Note: The tilde (~) removes leading/trailing double-quotes. rem * if "%SimoNOTE%" == "" set SimoNOTE=c:\SimoLIBR\LOGS\SimoTime.LOG echo %date% %time% %~1>> %SimoNOTE% echo %~1 The COBOL ProgramThis section will focus on the primary program (ALTINCC1.cbl) that does the actual processing of the COBOL Source Members. The primary program will call other command files to perform ancillary tasks. These secondary programs and associated links will be described in the Ancillary Functions section of this document. IDENTIFICATION DIVISION. PROGRAM-ID. ALTINCC1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * This program was generated by SimoZAPS * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * * Record Record Key * * Function Name Organization Format Max-Min Pos-Len * * -------- -------- ------------ -------- ------- ------- * * INPUT COBOLGET ASCII/CRLF VARIABLE 00080 * * OUTPUT COBOLPUT ASCII/CRLF VARIABLE 00080 * ***************************************************************** ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT COBOLGET-FILE ASSIGN TO COBOLGET ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS COBOLGET-STATUS. SELECT COBOLPUT-FILE ASSIGN TO COBOLPUT ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS COBOLPUT-STATUS. ***************************************************************** DATA DIVISION. FILE SECTION. FD COBOLGET-FILE DATA RECORD IS COBOLGET-REC . 01 COBOLGET-REC. 05 COBOLGET-DATA-01 PIC X(00080). FD COBOLPUT-FILE DATA RECORD IS COBOLPUT-REC . 01 COBOLPUT-REC. 05 COBOLPUT-DATA-01 PIC X(00080). ***************************************************************** WORKING-STORAGE SECTION. 01 SIM-TITLE. 05 T1 pic X(11) value '* ALTINCC1 '. 05 T2 pic X(34) value 'Replace -INC with Standard COPY '. 05 T3 pic X(10) value ' v11.10.24'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* ALTINCC1 '. 05 C2 pic X(32) value 'This Data File Convert Member wa'. 05 C3 pic X(32) value 's generated by SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 COBOLGET-STATUS. 05 COBOLGET-STATUS-L pic X. 05 COBOLGET-STATUS-R pic X. 01 COBOLGET-EOF pic X value 'N'. 01 COBOLGET-OPEN-FLAG pic X value 'C'. 01 COBOLPUT-STATUS. 05 COBOLPUT-STATUS-L pic X. 05 COBOLPUT-STATUS-R pic X. 01 COBOLPUT-EOF pic X value 'N'. 01 COBOLPUT-OPEN-FLAG pic X value 'C'. 01 COBOLGET-LRECL pic 9(5) value 00080. 01 COBOLPUT-LRECL pic 9(5) value 00080. ***************************************************************** * The following buffers are used to create a four-byte status * * code that may be displayed. * ***************************************************************** 01 IO-STATUS. 05 IO-STAT1 pic X. 05 IO-STAT2 pic X. 01 IO-STATUS-04. 05 IO-STATUS-0401 pic 9 value 0. 05 IO-STATUS-0403 pic 999 value 0. 01 TWO-BYTES-BINARY pic 9(4) BINARY. 01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY. 05 TWO-BYTES-LEFT pic X. 05 TWO-BYTES-RIGHT pic X. ***************************************************************** * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. * ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* ALTINCC1 '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(68) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. ***************************************************************** 01 PROGRAM-NAME pic X(8) value 'ALTINCC1'. 01 APPL-RESULT pic S9(9) comp. 88 APPL-AOK value 0. 88 APPL-EOF value 16. 01 IX-1 pic 9(5) value 0. 01 IX-2 pic 9(5) value 0. 01 WORK-08 pic X(8) value SPACES. 01 COBOLGET-TOTAL. 05 COBOLGET-RDR pic 9(9) value 0. 05 filler pic X(3) value ' - '. 05 filler pic X(23) value 'Line count for COBOLGET'. 01 COBOLPUT-TOTAL. 05 COBOLPUT-ADD pic 9(9) value 0. 05 filler pic X(3) value ' - '. 05 filler pic X(23) value 'Line count for COBOLPUT'. COPY PAENVARS. COPY BFLAGSB1. ***************************************************************** PROCEDURE DIVISION. perform ACTION-ONE perform COBOLGET-OPEN perform COBOLPUT-OPEN perform until COBOLGET-STATUS not = '00' perform COBOLGET-READ if COBOLGET-STATUS = '00' add 1 to COBOLGET-RDR perform BUILD-OUTPUT-RECORD perform COBOLPUT-WRITE if COBOLPUT-STATUS = '00' add 1 to COBOLPUT-ADD end-if end-if end-perform move COBOLGET-TOTAL to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLPUT-TOTAL to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT if APPL-EOF move 'is Complete...' to MESSAGE-TEXT else move 'is ABENDING...' to MESSAGE-TEXT end-if perform Z-DISPLAY-MESSAGE-TEXT perform COBOLPUT-CLOSE perform COBOLGET-CLOSE GOBACK. ***************************************************************** ACTION-ONE. perform Z-POST-COPYRIGHT * * Get Program Behavior Flags * FLAG-01 Y = Place Idendifier in position 01, ALTINC * FLAG-02 Y = Place Identifier in position 73, ALT-INC * FLAG-03 Y = Retain comment information from -INC Statement * FLAG-** Remaining flags are reserved for future use * move 'ALTINCBF' to ENV-VAR-NAME perform GET-ENVIRONMENT-VARIABLE if ENV-VAR-VALUE not = SPACES and ENV-VAR-VALUE(9:1) = '/' move ENV-VAR-VALUE(1:17) to BF-GROUP else move 'YYYNNNNN/NNNNNNNN' to BF-GROUP end-if exit. ***************************************************************** BUILD-OUTPUT-RECORD. if COBOLGET-REC(1:5) = '-INC ' * Edit for eight byte name move SPACES to WORK-08 add 6 to ZERO giving IX-1 add 1 to ZERO giving IX-2 * Find first byte of copy file name... perform until COBOLGET-REC(IX-1:1) not = SPACE or IX-1 > 63 if COBOLGET-REC(IX-1:1) = SPACE add 1 to IX-1 end-if end-perform * Save copy file name... perform until COBOLGET-REC(IX-1:1) = SPACE or IX-2 > 8 or IX-1 > 63 if COBOLGET-REC(IX-1:1) not = SPACE move COBOLGET-REC(IX-1:1) to WORK-08(IX-2:1) add 1 to IX-2 end-if add 1 to IX-1 end-perform * Create new output record or records... move SPACES to COBOLPUT-REC if BF-01 = 'Y' move 'ALTINC' to COBOLPUT-REC(1:6) end-if if COBOLGET-REC(15:56) = SPACES or BF-03 = 'N' move 'COPY' to COBOLPUT-REC(8:4) move WORK-08 to COBOLPUT-REC(13:8) else move COBOLGET-REC(15:56) to COBOLPUT-REC(15:56) move '*' to COBOLPUT-REC(7:1) if BF-02 = 'Y' move 'COPY-INC' to COBOLPUT-REC(73:8) end-if perform COBOLPUT-WRITE move SPACES to COBOLPUT-REC if BF-01 = 'Y' move 'ALTINC' to COBOLPUT-REC(1:6) end-if move 'COPY' to COBOLPUT-REC(8:4) move WORK-08 to COBOLPUT-REC(13:8) end-if if BF-02 = 'Y' move 'COPY-INC' to COBOLPUT-REC(73:8) end-if inspect COBOLPUT-REC(13:20) replacing first '. ' by ' ' inspect COBOLPUT-REC(13:20) replacing first ' ' by '. ' else move COBOLGET-REC(1:80) to COBOLPUT-REC(1:80) exit. ***************************************************************** * The ENV-VAR-NAME must contain the name of the variable... GET-ENVIRONMENT-VARIABLE. move SPACES to ENV-VAR-VALUE move 'GET' to ENV-VAR-REQUEST call 'MFENVARS' using ENV-VAR-PASSAREA if RETURN-CODE not = 0 move SPACES to ENV-VAR-VALUE end-if exit. ***************************************************************** * I/O Routines for the INPUT File... * ***************************************************************** COBOLGET-CLOSE. add 8 to ZERO giving APPL-RESULT. close COBOLGET-FILE if COBOLGET-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'CLOSE Failure with COBOLGET' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLGET-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* COBOLGET-READ. read COBOLGET-FILE if COBOLGET-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if COBOLGET-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 if APPL-EOF move 'Y' to COBOLGET-EOF else move 'READ Failure with COBOLGET' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLGET-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* COBOLGET-OPEN. add 8 to ZERO giving APPL-RESULT. open input COBOLGET-FILE if COBOLGET-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'O' to COBOLGET-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'OPEN Failure with COBOLGET' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLGET-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * I/O Routines for the OUTPUT File... * ***************************************************************** COBOLPUT-WRITE. if COBOLPUT-OPEN-FLAG = 'C' perform COBOLPUT-OPEN end-if write COBOLPUT-REC if COBOLPUT-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if COBOLPUT-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 'WRITE Failure with COBOLPUT' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLPUT-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* COBOLPUT-OPEN. add 8 to ZERO giving APPL-RESULT. open OUTPUT COBOLPUT-FILE if COBOLPUT-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'O' to COBOLPUT-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'OPEN Failure with COBOLPUT' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLPUT-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* COBOLPUT-CLOSE. add 8 to ZERO giving APPL-RESULT. close COBOLPUT-FILE if COBOLPUT-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'C' to COBOLPUT-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'CLOSE Failure with COBOLPUT' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move COBOLPUT-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * The following Z-ROUTINES provide administrative functions * * 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-MESSAGE-TEXT end-if move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT add 12 to ZERO giving RETURN-CODE STOP RUN. * exit. ***************************************************************** * Display CONSOLE messages... * ***************************************************************** Z-DISPLAY-MESSAGE-TEXT. 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 * * four digits. If the full two byte file status is numeric it * * will display as 00nn. If the 1st byte is a numeric nine (9) * * the second byte will be treated as a binary number and will * * display as 9nnn. * ***************************************************************** Z-DISPLAY-IO-STATUS. if IO-STATUS not NUMERIC or IO-STAT1 = '9' move IO-STAT1 to IO-STATUS-04(1:1) subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY move IO-STAT2 to TWO-BYTES-RIGHT add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403 move 'File Status is: nnnn' to MESSAGE-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:4) perform Z-DISPLAY-MESSAGE-TEXT else move '0000' to IO-STATUS-04 move IO-STATUS to IO-STATUS-04(3:2) move 'File Status is: nnnn' to MESSAGE-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:4) perform Z-DISPLAY-MESSAGE-TEXT end-if exit. ***************************************************************** Z-POST-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. ***************************************************************** * This program was generated by SimoZAPS * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** SummaryThis suite of programs is provided as a COBOL programming example of one of the possible solutions to replacing the coding techniques within COBOL Programs that make the source code non-compliant with the ANSI/85 standard. This suite of programs focuses on the replacement of -INC Statements with standard COBOL COPY Statements. 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 or Feedback section of this document.
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. Downloads and LinksThis 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. Current Server or Internet AccessThe following links may be to the current server or to the Internet. Explore the COBOL Connection for more examples of COBOL programming techniques and sample code. Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download. Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats. Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files. Internet Access RequiredThe following links will require an internet connection. 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. Glossary of TermsExplore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers. Contact or FeedbackThis document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
We appreciate hearing from you. Company OverviewSimoTime 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
|