BCS MVS COBOL Parameter Access

There are those times when parameters are useful to provide solution to automation tasks. This program takes a string of parameters delimited by a specific character and parses each parameter into a data area which is employed in subsequent processing.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABM00015.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/27/2014.
000600 DATE-COMPILED. 09/27/2014.
000700 ENVIRONMENT DIVISION.
000800 CONFIGURATION SECTION.
000900 SOURCE-COMPUTER. IBM-Z-OS.
001000 OBJECT-COMPUTER. IBM-Z-OS.
001100 INPUT-OUTPUT SECTION.
001200 FILE-CONTROL.
001300 DATA DIVISION.
001400 FILE SECTION.
001500 WORKING-STORAGE SECTION.
001600 01  PNDX PIC S9(4) COMP.
001700 01  PBUF-AREA.
001800     05  PBUF PIC X(100) OCCURS 100 TIMES.
001900 01  PARM-BUFFER.
002000     05  PARM-LENGTH PIC S9(4) COMP.
002100     05  PARM-DATA PIC X(256).
002200 01  NUM PIC S9(4) COMP.
002300 01  PARM-DELIMITER PIC X.
002400 PROCEDURE DIVISION.
002500     MOVE '@PARM1@PARM2@PARM3@PARM4@PARM5' TO PARM-DATA.
002600     MOVE 30 TO PARM-LENGTH.
002700     MOVE '@' TO PARM-DELIMITER.
002800     CALL 'ABS00011' USING PARM-BUFFER PBUF-AREA NUM
002900         PARM-DELIMITER.
003000     DISPLAY 'NUM = *' NUM '*'.
003100     MOVE 1 TO PNDX.
003200     PERFORM 0010-DISP-PARMS UNTIL PNDX > NUM.
003300     GOBACK.
003400 0010-DISP-PARMS.
003500     DISPLAY 'PB AREA =*' PBUF (PNDX) '*'.
003600     ADD 1 TO PNDX.

The called sub program that unstinting the parameters is shown here.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABS00011.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/27/2014.
000600 DATE-COMPILED. 09/27/2014.
000700 ENVIRONMENT DIVISION.
000800 CONFIGURATION SECTION.
000900 SOURCE-COMPUTER. IBM-Z-OS.
001000 OBJECT-COMPUTER. IBM-Z-OS.
001100 INPUT-OUTPUT SECTION.
001200 FILE-CONTROL.
001300 DATA DIVISION.
001400 FILE SECTION.
001500 WORKING-STORAGE SECTION.
001600 77  PC-INDX PIC 99.
001700 77  BF PIC 99.
001800 77  EF PIC 99.
001900 77  DNDX PIC 99.
002000 77  PNDX PIC 99.
002100 77  SOP PIC 99.
002200 77  EP PIC 99.
002300 77  RX PIC 99.
002400 77  PP PIC 99.
002500 01  PPD-AREA.
002600     05  PPD PIC X OCCURS 100 TIMES.
002700 01  DET-NDX-AREA.
002800     05  DET-NDX PIC 99 OCCURS 100 TIMES.
002900 01  PP2 PIC S9(4) COMP.
003000 LINKAGE SECTION.
003100 01  PARM-BUFFER.
003200     05  PARM-LENGTH PIC S9(4) COMP.
003300     05  PARM-DATA PIC X(256).
003400     05  PARM-CHAR-AREA REDEFINES PARM-DATA.
003500         10  PARM-CHAR OCCURS 256 TIMES PIC X.
003600 01  PBUF-AREA.
003700     05  PBUF PIC X(100) OCCURS 100 TIMES.
003800 01  ROP PIC S9(4) COMP.
003900 01  PARM-DELIMITER PIC X.
004000 PROCEDURE DIVISION USING PARM-BUFFER PBUF-AREA ROP
004100     PARM-DELIMITER.
004200*    MOVE '@PARM1@PARM2@PARM3@PARM4@PARM5' TO PARM-DATA.
004300*    MOVE 30 TO PARM-LENGTH.
004400     MOVE 1 TO DNDX.
004500     PERFORM 0010-DET-FLAG VARYING PC-INDX FROM 1 BY 1
004600         UNTIL PC-INDX > PARM-LENGTH.
004700     PERFORM 0030-GET-PARMS.
004800     PERFORM 0050-PRINT-PARMS.
004900     GOBACK.
005000 0010-DET-FLAG.
005100     IF PARM-CHAR (PC-INDX) = PARM-DELIMITER THEN
005200         PERFORM 0020-FIELD-FOUND.
005300 0020-FIELD-FOUND.
005400     MOVE PC-INDX TO DET-NDX (DNDX).
005500     ADD 1 TO DNDX.
005600 0030-GET-PARMS.
005700     SUBTRACT 1 FROM DNDX.
005800     MOVE DNDX TO ROP.
005900     MOVE 1 TO DNDX.
006000     PERFORM 0040-FETCH-PARM UNTIL DNDX > ROP.
006100 0040-FETCH-PARM.
006200     COMPUTE SOP = DET-NDX (DNDX) + 1.
006300     IF DNDX < ROP THEN
006400         COMPUTE EP = DET-NDX (DNDX + 1) - 1
006500     ELSE
006600        COMPUTE EP = PARM-LENGTH.
006700     MOVE SPACES TO PBUF (DNDX).
006800     MOVE PARM-DATA (SOP:EP) TO PBUF (DNDX).
006900     PERFORM 0070-GET-CHARS.
007000     MOVE PPD-AREA TO PBUF (DNDX).
007100     ADD 1 TO DNDX.
007200 0050-PRINT-PARMS.
007300     MOVE 1 TO DNDX.
007400     PERFORM 0060-DISP-PARMS ROP TIMES.
007500 0060-DISP-PARMS.
007600     ADD 1 TO DNDX.
007700 0070-GET-CHARS.
007800     MOVE 1 TO RX.
007900     MOVE SOP TO PP.
008000     MOVE EP TO PP2.
008100     PERFORM 0080-MOVE-CHAR UNTIL PP > PP2.
008200*    DISPLAY 'PPD = *' PPD-AREA '*'.
008300 0080-MOVE-CHAR.
008400     MOVE PARM-DATA (PP:PP) TO PPD (RX).
008500     ADD 1 TO RX.
008600     ADD 1 TO PP.

The clist (command procedure) for invoking the main program is as follows.

PROC 0
CONTROL NOLIST NOMSG
FREE FI(SYSOUT SYSPRINT)
ALLOC FI(SYSPRINT) DA(*)
ALLOC FI(SYSOUT) DA(OUT) SHR
CALL 'AMBMVS.PDS.LOAD(ABM00015)'
FREE FI(SYSOUT SYSPRINT)
ISPEXEC BROWSE DATASET(OUT)

Notice the clist provide file allocations and calls the main program for execution.  Upon execution the dialog management facility browse in invoked without further user input.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS COBOL Prepare Current Date

There comes the time when it is beneficial to format the current date and time. The following COBOL sub routine does exactly that.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00010.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/25/2014.                                       00050000
000600 DATE-COMPILED. 09/25/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 INPUT-OUTPUT SECTION.                                            00110000
001200 FILE-CONTROL.                                                    00120000
001300 DATA DIVISION.                                                   00130000
001400 FILE SECTION.                                                    00140000
001500 WORKING-STORAGE SECTION.                                         00150000
001600 01  WS-CURRENT-DATE.                                             00160002
001700     05  CC PIC XX.                                               00170001
001800     05  YY PIC XX.                                               00180001
001900     05  MM PIC XX.                                               00190001
002000     05  DD PIC XX.                                               00200001
002100     05  HH PIC XX.                                               00210001
002200     05  MN PIC XX.                                               00220006
002300     05  SS PIC XX.                                               00230001
002400     05  SSHH PIC XX.                                             00240001
002500     05  GMTO PIC X(5).                                           00250001
003210 LINKAGE SECTION.                                                 00321003
003300 01  FMT-DATE PIC X(10).                                          00330002
003310 01  SHORT-DATE REDEFINES FMT-DATE.                               00331003
003320     05  MM PIC XX.                                               00332003
003330     05  P1 PIC X.                                                00333005
003340     05  DD PIC XX.                                               00334003
003350     05  P2 PIC X.                                                00335005
003360     05  CC PIC XX.                                               00336003
003370     05  YY PIC XX.                                               00337003
003400 PROCEDURE DIVISION USING FMT-DATE.                               00340001
003500     MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE.               00350002
003510     MOVE '/' TO P1.                                              00351005
003520     MOVE '/' TO P2.                                              00352005
003600     MOVE CORR WS-CURRENT-DATE TO SHORT-DATE.                     00360002
003700     CALL 'ABS00007'.                                             00370000

Notice the usage of move corr (esponding) statement.  This one statement properly populates the formatted output area.  As long as the data names correspond this statement works flawlessly.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS 8080 Reproduction With Modifications

This example demonstrates how to use available COBOL sub programs to perform reproduction of 80 column records. This framework hands you the underpinnings clone source code.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABM00017.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/30/2014.
000600 DATE-COMPILED. 09/30/2014.
000700*
000800*
000900*  THIS PROGRAM PROVIDES ALL NECESSARY COMMUNICATION TO PROCESS
001000*  ALL THE RECORDS IN THE INPUT FILE.
001100*
001200*  AFTER PROCESSING IS COMPLETE THE FILES ARE CLOSED
001300*
001400*
001500 ENVIRONMENT DIVISION.
001600 CONFIGURATION SECTION.
001700 SOURCE-COMPUTER. IBM-Z-OS.
001800 OBJECT-COMPUTER. IBM-Z-OS.
001900 INPUT-OUTPUT SECTION.
002000 FILE-CONTROL.
002100 DATA DIVISION.
002200 FILE SECTION.
002300 WORKING-STORAGE SECTION.
002400 01  EOF-SW PIC X.
002500     88  EOF VALUE 'X'.
002600 01  BUF PIC X(80).
002700 PROCEDURE DIVISION.
002800*  OPEN INPUT FILE
002900     CALL 'ABS00014' USING EOF-SW.
003000*  OPEN OUTPUT FILE
003100     CALL 'ABS00003'.
003200*  PREPARE RECORDS UNTIL ALL ARE PROCESSED
003300     PERFORM 0010-PROC-RECS UNTIL EOF.
003400*  CLOSE INPUT FILE
003500     CALL 'ABS0014B'.
003600*  CLOSE OUTPUT FILE
003700     CALL 'ABS0003B'.
003800     GOBACK.
003900*  PROCESS ALL RECORDS
004000 0010-PROC-RECS.
004100     CALL 'ABS0014A' USING BUF, EOF-SW.
004200     IF NOT EOF THEN
004300         PERFORM 0020-FIX-REC.
004400*  MODIFY RECORDS BEFORE WRITING THE TO THE OUTPUT FILE.
004500 0020-FIX-REC.
004600     CALL 'ABS0003A' USING BUF.

The following code describes the code that reads the records.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABS00014.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/15/2014.
000600 DATE-COMPILED. 09/15/2014.
000700*
000800*  THIS PROGRAM IS DESIGNED TO PROVIDE ALL NECESSARY COMMMUNCATIONS
000900*  TO READ 80 BYTE RECORDS FROM THE INPUT FILE.
001000*
001100*  THE END OF FILE SWITCH IS SET WHEN THE END OF THE DATA IS REACHED.
001200*
001300 ENVIRONMENT DIVISION.
001400 INPUT-OUTPUT SECTION.
001500 FILE-CONTROL.
001600     SELECT I-FILE ASSIGN TO UT-S-FSIN
001700     ORGANIZATION IS SEQUENTIAL.
001800 DATA DIVISION.
001900 FILE SECTION.
002000 FD  I-FILE
002100     DATA RECORD IS I-RECORD
002200     BLOCK CONTAINS 0 RECORDS
002300     RECORDING MODE IS F.
002400 01  I-RECORD PIC X(80).
002500 WORKING-STORAGE SECTION.
002600 LINKAGE SECTION.
002700 01  EOF-SW PIC X.
002800     88 EOF VALUE 'X'.
002900 01  LSBUF PIC X(80).
003000 PROCEDURE DIVISION USING EOF-SW.
003100*  OPEN THE INPUT FILE
003200     MOVE ' ' TO EOF-SW.
003300     OPEN INPUT I-FILE.
003400     PERFORM 0020-RETURN.
003500*  READ THE FILE
003600     ENTRY 'ABS0014A' USING LSBUF EOF-SW.
003700     READ I-FILE
003800         AT END MOVE 'X' TO EOF-SW.
003900     IF NOT EOF THEN
004000         PERFORM 0010-FIX-RECORD.
004100     PERFORM 0020-RETURN.
004200 0010-FIX-RECORD.
004300     MOVE I-RECORD TO LSBUF.
004400 0012-STOP-FLOW.
004500*  CLOSE THE FILE
004600     ENTRY 'ABS0014B'.
004700     CLOSE I-FILE.
004800     PERFORM 0020-RETURN.
004900*  LET'S GET OUT OF HERE
005000 0020-RETURN.
005100     GOBACK.

Now the code in this section allows us to output the data.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABS00003.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/15/2014.
000600 DATE-COMPILED. 09/15/2014.
000700*
000800*
000900*  THIS PROGRAM IS DESIGNED TO WRITE RECORDS TO THE FILE.
001000*
001100*
001200*
001300*
001400 ENVIRONMENT DIVISION.
001500 INPUT-OUTPUT SECTION.
001600 FILE-CONTROL.
001700     SELECT F-FILE ASSIGN TO UT-S-FSOUT
001800     ORGANIZATION IS SEQUENTIAL.
001900 DATA DIVISION.
002000 FILE SECTION.
002100 FD  F-FILE
002200     DATA RECORD IS F-RECORD
002300     BLOCK CONTAINS 0 RECORDS
002400     RECORDING MODE IS F.
002500 01  F-RECORD PIC X(80).
002600 WORKING-STORAGE SECTION.
002700 LINKAGE SECTION.
002800 01  LSBUF PIC X(80).
002900 PROCEDURE DIVISION.
003000*  OPEN THE OUTPUT FILE
003100     OPEN OUTPUT F-FILE.
003200     PERFORM 0010-RETURN.
003300*  WRITE A RECORD
003400     ENTRY 'ABS0003A' USING LSBUF.
003500     WRITE F-RECORD FROM LSBUF.
003600     PERFORM 0010-RETURN.
003700*  CLOSE THE FILE
003800     ENTRY 'ABS0003B'.
003900     CLOSE F-FILE.
004000     PERFORM 0010-RETURN.
004100*  LETS GET OUT OF HERE
004200 0010-RETURN.
004300     GOBACK.

The code below describes the command list (clist) employed to invoke the program after compiling and linking.

PROC 0
CONTROL NOLIST NOMSG
FREE FI(SYSOUT SYSPRINT FSIN FSOUT)
ALLOC FI(SYSPRINT) DA(*)
ALLOC FI(SYSOUT) DA(OUT) SHR
ALLOC FI(FSIN) DA(PDS.COBOL(ABM00016))
ALLOC FI(FSOUT) DA(TST)
CALL 'AMBMVS.PDS.LOAD(ABM00017)'
FREE FI(SYSOUT SYSPRINT FSIN FSOUT)
ISPEXEC BROWSE DATASET(TST)

These routines can be used to tailor almost any type of source code.  What I recommend is to clone a copy of this software then add the desirable functionality to generate the end result source code.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS COBOL Subroutine ABS00007

This routine’s function is quite simple.It’s only function is to execute the goback command. Almost every program uses goback at least once. By using this approach COBOL programs avoid code bloat. There is overhead using goback. This approach minimizes that code bloat.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00007.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/15/2014.                                       00050000
000600 DATE-COMPILED. 09/15/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001010 INPUT-OUTPUT SECTION.                                            00101000
001020 FILE-CONTROL.                                                    00102000
001030 DATA DIVISION.                                                   00103000
001040 FILE SECTION.                                                    00104000
001050 WORKING-STORAGE SECTION.                                         00105000
001060 PROCEDURE DIVISION.                                              00106000
001070     GOBACK.                                                      00107000

Below is the compiler output.

1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/21/2014  Time 06:57:58   Page     1
0Invocation parameters:
  VBREF
0Options in effect:
  NOADATA
    ADV
    QUOTE
    ARITH(COMPAT)
  NOAWO
    BUFSIZE(4096)
  NOCICS
    CODEPAGE(1140)
  NOCOMPILE(S)
  NOCURRENCY
    DATA(31)
  NODATEPROC
    DBCS
  NODECK
  NODIAGTRUNC
  NODLL
  NODUMP
  NODYNAM
  NOEXIT
  NOEXPORTALL
  NOFASTSRT
    FLAG(I,I)
  NOFLAGSTD
    INTDATE(ANSI)
    LANGUAGE(EN)
  NOLIB
    LINECOUNT(60)
  NOLIST
  NOMAP
  NOMDECK
  NONAME
    NSYMBOL(NATIONAL)
  NONUMBER
    NUMPROC(NOPFD)
    OBJECT
  NOOFFSET
  NOOPTIMIZE
    OUTDD(SYSOUT)
    PGMNAME(COMPAT)
    RENT
    RMODE(AUTO)
    SEQUENCE
    SIZE(MAX)
    SOURCE
    SPACE(1)
  NOSQL
    SQLCCSID
  NOSSRANGE
  NOTERM
  NOTEST
  NOTHREAD
    TRUNC(STD)
    VBREF
  NOWORD
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/21/2014  Time 06:57:58   Page     2
0   XMLPARSE(XMLSS)
    XREF(FULL)
    YEARWINDOW(1900)
    ZWB
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00007  Date 09/21/2014  Time 06:57:58   Page     3
   LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
0  000001         000100 IDENTIFICATION DIVISION.                                         00010000
   000002         000200 PROGRAM-ID.    ABS00007.                                         00020000
   000003         000300 AUTHOR.        ARCH BROOKS.                                      00030000
   000004         000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
   000005         000500 DATE-WRITTEN.  09/15/2014.                                       00050000
   000006         000600 DATE-COMPILED. 09/21/14.                                         00060000
   000007         000700 ENVIRONMENT DIVISION.                                            00070000
   000008         000800 CONFIGURATION SECTION.                                           00080000
   000009         000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
   000010         001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
   000011         001010 INPUT-OUTPUT SECTION.                                            00101000
   000012         001020 FILE-CONTROL.                                                    00102000
   000013         001030 DATA DIVISION.                                                   00103000
   000014         001040 FILE SECTION.                                                    00104000
   000015         001050 WORKING-STORAGE SECTION.                                         00105000
   000016         001060 PROCEDURE DIVISION.                                              00106000
   000017         001070     GOBACK.                                                      00107000
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00007  Date 09/21/2014  Time 06:57:58   Page     4
0 Count   Cross-reference of verbs        References
 
 1        GOBACK . . . . . . . . . . . .  17
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00007  Date 09/21/2014  Time 06:57:58   Page     5
0An "M" preceding a data-name reference indicates that the data-name is modified by this reference.
 
  Defined   Cross-reference of data names   References
 
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00007  Date 09/21/2014  Time 06:57:58   Page     6
0 Defined   Cross-reference of programs     References
 
        2   ABS00007
-* Statistics for COBOL program ABS00007:
 *    Source records = 17
 *    Data Division statements = 0
 *    Procedure Division statements = 1
0End of compilation 1,  program ABS00007,  no statements flagged.
0Return code 0

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS Return Code

There is something strange about return code when you use ISPF service calls. This article will outline the steps taken and code involved so you may trace this development effort with me.

Below is the listing of the invoking clist.

PROC 0
CONTROL LIST
FREE FI(FSOUT SYSOUT)
ALLOC FI(FSOUT) DA(TST) SHR
ALLOC FI(SYSOUT) DA(OUT) SHR
CALL 'AMBMVS.PDS.LOAD(ABM00003)'
FREE FI(FSOUT SYSOUT)

Our main program is listed below.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    BCSCOB01.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/18/2014.                                       00050000
000600 DATE-COMPILED. 09/18/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 DATA DIVISION.                                                   00110000
001200 WORKING-STORAGE SECTION.                                         00120000
001210 01  CMDBUF PIC X(500).                                           00121000
001220 01  RC PIC S9(4) COMP.                                           00122008
001230 01  OUT-AREA.                                                    00123004
001240     05  RECVAL PIC 9(5).                                         00124008
001250     05  FILLER PIC X.                                            00125004
001260     05  MSG PIC X(74).                                           00126004
001300 PROCEDURE DIVISION.                                              00130000
001301     CALL 'ABS00003'.                                             00130104
001302     MOVE 'EDIT DATASET(PDS.COBOL(ABS00004))' TO CMDBUF.          00130203
001310     CALL 'ABS00001' USING CMDBUF RC.                             00131003
001311     MOVE RC TO RECVAL.                                           00131104
001312     MOVE 'FIRST CALL TO ROUTINE' TO MSG.                         00131204
001320     CALL 'ABS0003A' USING OUT-AREA.                              00132005
001321     MOVE 'EDIT DATASET(PDS.COBOL(ABS00004)' TO CMDBUF.           00132104
001322     CALL 'ABS00001' USING CMDBUF RC.                             00132204
001323     MOVE RC TO RECVAL.                                           00132304
001324     MOVE 'SECOND CALL TO ROUTINE' TO MSG.                        00132404
001325     CALL 'ABS0003A' USING OUT-AREA.                              00132505
001330     CALL 'ABS0003B'.                                             00133004
001400     GOBACK.                                                      00140000

Sub routine ABS00003 performs physical sequential output to a fixed block logical record length of 80 characters.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00003.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/15/2014.                                       00050000
000600 DATE-COMPILED. 09/15/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000710 INPUT-OUTPUT SECTION.                                            00071000
000720 FILE-CONTROL.                                                    00072000
000730     SELECT F-FILE ASSIGN TO UT-S-FSOUT                           00073000
000740     ORGANIZATION IS SEQUENTIAL.                                  00074000
000750 DATA DIVISION.                                                   00075000
000760 FILE SECTION.                                                    00076000
000770 FD  F-FILE                                                       00077000
000780     DATA RECORD IS F-RECORD                                      00078000
000781     BLOCK CONTAINS 0 RECORDS                                     00078103
000790     RECORDING MODE IS F.                                         00079000
000900 01  F-RECORD PIC X(80).                                          00090000
001000 WORKING-STORAGE SECTION.                                         00100000
001100 LINKAGE SECTION.                                                 00110000
001200 01  EOF-SW PIC X.                                                00120000
001210 01  LSBUF PIC X(80).                                             00121000
001220 PROCEDURE DIVISION.                                              00122000
001230     OPEN OUTPUT F-FILE.                                          00123000
001240     GOBACK.                                                      00124000
001250     ENTRY 'ABS0003A' USING LSBUF.                                00125004
001251     WRITE F-RECORD FROM LSBUF.                                   00125100
001280     GOBACK.                                                      00128000
001290     ENTRY 'ABS0003B'.                                            00129001
001300     CLOSE F-FILE.                                                00130000
001400     GOBACK.                                                      00140000

Here is the source code that issues the ISPF command to make the dialog function.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00001.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/18/2014.                                       00050009
000600 DATE-COMPILED. 09/18/2014.                                       00060009
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 DATA DIVISION.                                                   00110000
001200 WORKING-STORAGE SECTION.                                         00120000
001210 01  RVAL PIC 9999.                                               00121024
001300 01  RCL PIC S9(5) COMP.                                          00130020
001400 01  OBUF.                                                        00140021
001500     05  RET PIC 9999.                                            00150021
001510     05  FILLER PIC X.                                            00151021
001520     05  MSG PIC X(75).                                           00152021
001600 LINKAGE SECTION.                                                 00160000
001700 01   COMD PIC X(500).                                            00170000
001710 01   RC  PIC S9(4) COMP.                                         00171019
001800 PROCEDURE DIVISION USING COMD RC.                                00180010
001900     CALL 'ABS00004' USING COMD, RCL.                             00190024
001930     CALL 'ISPEXEC' USING RCL, COMD.                              00193025
001931     DISPLAY 'RETURN CODE IS *' RETURN-CODE '*'.                  00193127
001933     MOVE RETURN-CODE TO RET.                                     00193325
001934     MOVE RETURN-CODE TO RC.                                      00193426
001935     MOVE 'IN SUBROUTINE' TO MSG.                                 00193522
001936     CALL 'ABS0003A' USING OBUF.                                  00193622
002000     GOBACK.                                                      00200000

Notice the display statement immediately after calling ISPEXEC.  It also indicates the return code is 4.

Next we will view the code that determines the usable length of  the command string in the 500 byte command buffer.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00004                                          00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/18/2014.                                       00050000
000600 DATE-COMPILED. 09/18/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 DATA DIVISION.                                                   00110000
001200 WORKING-STORAGE SECTION.                                         00120000
001210 LINKAGE SECTION.                                                 00121000
001211 01  FSBUF PIC X(500).                                            00121100
001212 01  FSBUF-RED REDEFINES FSBUF.                                   00121200
001213     05  BS PIC X OCCURS 500 TIMES.                               00121300
001214 01  BC PIC S9(5) COMP.                                           00121404
001215 PROCEDURE DIVISION USING FSBUF BC.                               00121500
001250     PERFORM 0010-FIND-NS VARYING BC FROM 500 BY -1               00125000
001260       UNTIL ((BS (BC) NOT EQUAL SPACES) OR                       00126002
001270              (BC IS LESS THAN 2)).                               00127003
001320     GOBACK.                                                      00132000
001330 0010-FIND-NS.                                                    00133000

I am sure there is a logical explanation to this problem but right now I do no know what it is.

I am including the compiled listing for ABS00001 to show the compile options used.  The options are the same for all the compiled programs.

1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/19/2014  Time 06:04:26   Page     1
0Invocation parameters:
  VBREF
0Options in effect:
  NOADATA
    ADV
    QUOTE
    ARITH(COMPAT)
  NOAWO
    BUFSIZE(4096)
  NOCICS
    CODEPAGE(1140)
  NOCOMPILE(S)
  NOCURRENCY
    DATA(31)
  NODATEPROC
    DBCS
  NODECK
  NODIAGTRUNC
  NODLL
  NODUMP
  NODYNAM
  NOEXIT
  NOEXPORTALL
  NOFASTSRT
    FLAG(I,I)
  NOFLAGSTD
    INTDATE(ANSI)
    LANGUAGE(EN)
  NOLIB
    LINECOUNT(60)
  NOLIST
  NOMAP
  NOMDECK
  NONAME
    NSYMBOL(NATIONAL)
  NONUMBER
    NUMPROC(NOPFD)
    OBJECT
  NOOFFSET
  NOOPTIMIZE
    OUTDD(SYSOUT)
    PGMNAME(COMPAT)
    RENT
    RMODE(AUTO)
    SEQUENCE
    SIZE(MAX)
    SOURCE
    SPACE(1)
  NOSQL
    SQLCCSID
  NOSSRANGE
  NOTERM
  NOTEST
  NOTHREAD
    TRUNC(STD)
    VBREF
  NOWORD
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/19/2014  Time 06:04:26   Page     2
0   XMLPARSE(XMLSS)
    XREF(FULL)
    YEARWINDOW(1900)
    ZWB
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00002  Date 09/19/2014  Time 06:04:26   Page     3
   LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
0  000001         000100 IDENTIFICATION DIVISION.                                         00010000
   000002         000200 PROGRAM-ID.    ABS00002.                                         00020000
   000003         000300 AUTHOR.        ARCH BROOKS.                                      00030000
   000004         000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
   000005         000500 DATE-WRITTEN.  09/15/2014.                                       00050000
   000006         000600 DATE-COMPILED. 09/19/14.                                         00060000
   000007         000700 ENVIRONMENT DIVISION.                                            00070000
   000008         000710 INPUT-OUTPUT SECTION.                                            00071000
   000009         000720 FILE-CONTROL.                                                    00072000
   000010         000730     SELECT V-FILE ASSIGN TO UT-S-VSINP                           00073021 14
   000011         000740     ORGANIZATION IS SEQUENTIAL.                                  00074002
   000012         001100 DATA DIVISION.                                                   00110000
   000013         001110 FILE SECTION.                                                    00111000
   000014         001120 FD  V-FILE                                                       00112005
   000015         001121     DATA RECORD IS V-RECORD                                      00112116 *
   000016         001122     BLOCK CONTAINS 0 RECORDS                                     00112224
   000017         001123     RECORDING MODE IS V                                          00112310
   000018         001124     RECORD IS VARYING IN SIZE FROM 1 TO 255 DEPENDING ON REC-LEN.00112426 *
   000019         001130 01  V-RECORD PIC X(255).                                         00113026
   000020         001200 WORKING-STORAGE SECTION.                                         00120000
   000021         001201 01  REC-LEN PIC 9(5).                                            00120125
   000022         001210 LINKAGE SECTION.                                                 00121000
   000023         001211 01  EOF-SW PIC X.                                                00121120
   000024         001220 01  LSBUF PIC X(80).                                             00122000
   000025         001300 PROCEDURE DIVISION.                                              00130020
   000026         001310     OPEN INPUT V-FILE.                                           00131006 14
   000027         001400     GOBACK.                                                      00140000
   000028         001500     ENTRY 'ABS0002A' USING LSBUF, EOF-SW.                        00150020 24 23
   000029         001600     READ V-FILE INTO LSBUF                                       00160000 14 24
   000030      1  001700         AT END MOVE 'X' TO EOF-SW.                               00170000 23
   000031         001800     GOBACK.                                                      00180000
   000032         001900     ENTRY 'ABS0002B'.                                            00190022
   000033         002000     CLOSE V-FILE.                                                00200000 14
   000034         002100     GOBACK.                                                      00210000
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00002  Date 09/19/2014  Time 06:04:26   Page     4
0 Count   Cross-reference of verbs        References
 
 1        CLOSE. . . . . . . . . . . . .  33
 2        ENTRY. . . . . . . . . . . . .  28 32
 3        GOBACK . . . . . . . . . . . .  27 31 34
 1        MOVE . . . . . . . . . . . . .  30
 1        OPEN . . . . . . . . . . . . .  26
 1        READ . . . . . . . . . . . . .  29
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00002  Date 09/19/2014  Time 06:04:26   Page     5
0An "M" preceding a data-name reference indicates that the data-name is modified by this reference.
 
  Defined   Cross-reference of data names   References
 
       23   EOF-SW . . . . . . . . . . . .  28 M30
       24   LSBUF. . . . . . . . . . . . .  28 M29
       21   REC-LEN. . . . . . . . . . . .  18
       14   V-FILE . . . . . . . . . . . .  10 26 29 33
       19   V-RECORD
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00002  Date 09/19/2014  Time 06:04:26   Page     6
0 Defined   Cross-reference of programs     References
 
        2   ABS00002
-* Statistics for COBOL program ABS00002:
 *    Source records = 34
 *    Data Division statements = 4
 *    Procedure Division statements = 9
0End of compilation 1,  program ABS00002,  no statements flagged.
0Return code 0

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS COBOL Routine To Detect Length Of A String

There comes a time when the trailing blanks of a string need to be counted. This COBOL sub program tells you the length of a string based on a 500 character input buffer.

The source code is below.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00004                                          00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/18/2014.                                       00050000
000600 DATE-COMPILED. 09/18/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 DATA DIVISION.                                                   00110000
001200 WORKING-STORAGE SECTION.                                         00120000
001210 LINKAGE SECTION.                                                 00121000
001211 01  FSBUF PIC X(500).                                            00121100
001212 01  FSBUF-RED REDEFINES FSBUF.                                   00121200
001213     05  BS PIC X OCCURS 500 TIMES.                               00121300
001214 01  BC PIC 9(5) COMP.                                            00121400
001215 PROCEDURE DIVISION USING FSBUF BC.                               00121500
001250     PERFORM 0010-FIND-NS VARYING BC FROM 500 BY -1               00125000
001260       UNTIL BS (BC) NOT EQUAL SPACES.                            00126000
001320     GOBACK.                                                      00132000
001330 0010-FIND-NS.                                                    00133000

There are two parameters passed to the sub routine and they are the 500 character buffer FSBUF and a full word binary counter BC.  The routine begins at the end of the string and counts backwards until a non blank character is detected.  The actual string length is in the variable BC.  You can subsequently pass that to an ISPF command routine or for any other purpose you have for determining the length of a string (minus characters padded to the right).

Below is the compiled computer listing for this routine.

1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/18/2014  Time 15:26:05   Page     1
0Invocation parameters:
  VBREF
0Options in effect:
  NOADATA
    ADV
    QUOTE
    ARITH(COMPAT)
  NOAWO
    BUFSIZE(4096)
  NOCICS
    CODEPAGE(1140)
  NOCOMPILE(S)
  NOCURRENCY
    DATA(31)
  NODATEPROC
    DBCS
  NODECK
  NODIAGTRUNC
  NODLL
  NODUMP
  NODYNAM
  NOEXIT
  NOEXPORTALL
  NOFASTSRT
    FLAG(I,I)
  NOFLAGSTD
    INTDATE(ANSI)
    LANGUAGE(EN)
  NOLIB
    LINECOUNT(60)
  NOLIST
  NOMAP
  NOMDECK
  NONAME
    NSYMBOL(NATIONAL)
  NONUMBER
    NUMPROC(NOPFD)
    OBJECT
  NOOFFSET
  NOOPTIMIZE
    OUTDD(SYSOUT)
    PGMNAME(COMPAT)
    RENT
    RMODE(AUTO)
    SEQUENCE
    SIZE(MAX)
    SOURCE
    SPACE(1)
  NOSQL
    SQLCCSID
  NOSSRANGE
  NOTERM
  NOTEST
  NOTHREAD
    TRUNC(STD)
    VBREF
  NOWORD
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0                         Date 09/18/2014  Time 15:26:05   Page     2
0   XMLPARSE(XMLSS)
    XREF(FULL)
    YEARWINDOW(1900)
    ZWB
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00004  Date 09/18/2014  Time 15:26:05   Page     3
   LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
0  000001         000100 IDENTIFICATION DIVISION.                                         00010000
   000002         000200 PROGRAM-ID.    ABS00004                                          00020000
   000003         000300 AUTHOR.        ARCH BROOKS.                                      00030000
   000004         000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
   000005         000500 DATE-WRITTEN.  09/18/2014.                                       00050000
   000006         000600 DATE-COMPILED. 09/18/14.                                         00060000
   000007         000700 ENVIRONMENT DIVISION.                                            00070000
   000008         000800 CONFIGURATION SECTION.                                           00080000
   000009         000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
   000010         001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
   000011         001100 DATA DIVISION.                                                   00110000
   000012         001200 WORKING-STORAGE SECTION.                                         00120000
   000013         001202 77  RBUF PIC X(80).                                              00120200
   000014         001207 01  OUTBUF.                                                      00120700
   000015         001208     05  RSIZ PIC 9(5).                                           00120800
   000016         001209     05  FILLER PIC X(75).                                        00120900
   000017         001210 LINKAGE SECTION.                                                 00121000
   000018         001211 01  FSBUF PIC X(500).                                            00121100
   000019         001212 01  FSBUF-RED REDEFINES FSBUF.                                   00121200 18
   000020         001213     05  BS PIC X OCCURS 500 TIMES.                               00121300
   000021         001214 01  BC PIC 9(5) COMP.                                            00121400
   000022         001215 PROCEDURE DIVISION USING FSBUF BC.                               00121500 18 21
   000023         001250     PERFORM 0010-FIND-NS VARYING BC FROM 500 BY -1               00125000 26 21
   000024         001260       UNTIL BS (BC) NOT EQUAL SPACES.                            00126000 20 21 IMP
   000025         001320     GOBACK.                                                      00132000
   000026         001330 0010-FIND-NS.                                                    00133000
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00004  Date 09/18/2014  Time 15:26:05   Page     4
0 Count   Cross-reference of verbs        References
 
 1        GOBACK . . . . . . . . . . . .  25
 1        PERFORM. . . . . . . . . . . .  23
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00004  Date 09/18/2014  Time 15:26:05   Page     5
0An "M" preceding a data-name reference indicates that the data-name is modified by this reference.
 
  Defined   Cross-reference of data names   References
 
       21   BC . . . . . . . . . . . . . .  22 M23 24
       20   BS . . . . . . . . . . . . . .  24
       18   FSBUF. . . . . . . . . . . . .  19 22
       19   FSBUF-RED
       14   OUTBUF
       13   RBUF
       15   RSIZ
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00004  Date 09/18/2014  Time 15:26:05   Page     6
0Context usage is indicated by the letter preceding a procedure-name reference.
 These letters and their meanings are:
     A = ALTER (procedure-name)
     D = GO TO (procedure-name) DEPENDING ON
     E = End of range of (PERFORM) through (procedure-name)
     G = GO TO (procedure-name)
     P = PERFORM (procedure-name)
     T = (ALTER) TO PROCEED TO (procedure-name)
     U = USE FOR DEBUGGING (procedure-name)
 
  Defined   Cross-reference of procedures   References
 
       26   0010-FIND-NS . . . . . . . . .  P23
1PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0               ABS00004  Date 09/18/2014  Time 15:26:05   Page     7
0 Defined   Cross-reference of programs     References
 
        2   ABS00004
-* Statistics for COBOL program ABS00004:
 *    Source records = 26
 *    Data Division statements = 7
 *    Procedure Division statements = 2
0End of compilation 1,  program ABS00004,  no statements flagged.
0Return code 0

Please feel free to comment about this program in the comments section.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS COBOL Development Tool Kit

The COBOL programming language is very versatile in the MVS environment. There are many practical applications for the use and implementation of solutions using COBOL. The BCS COBOL Development Tool Kit navigates the MVS and ISPF environment so that a point and click solution to many of the perfunctory COBOL tasks.

The toolkit allows the user to:

  • Chose the COBOL program to modify, compile and link edit.
  • Invoke the ISPF editor (Option 2) for subsequent programming changes.
  • Invoke the COBOL compiler and produce output object code and compiler listing.
  • View the compiler listing to verify compiler results.

The following listing reveals the clist (command list) to make these functions available.

PROC 0
ISPEXEC LMINIT DATAID(DV) DATASET(PDS.COBOL)
ISPEXEC LMOPEN  DATAID(&DV)
ISPEXEC LMMDISP DATAID(&DV) COMMANDS(ANY)
ISPEXEC LMCLOSE DATAID(&DV)
ISPEXEC EDIT DATASET(PDS.COBOL(&ZLMEMBER))
EX PDS.CLIST(CCOMP) '&ZLMEMBER'
WRITE RETURN CODE IS &LASTCC MEMBER * &ZLMEMBER *

Below is a video to show the BCS COBOL Tool Kit in action.

These as well as other tools are available to allieviate some of the drudgery of developing software on the IBM mainframe.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS DMF Pick List Object and Invoke Linkage Editor

Now the fun begins. A dialog has been designed that produces a pick list of objects from the pds.obj partitioned data set. When the desired member is clicked the name us stored then passed to the clist (command list) the invokes the linkage editor. The linkage editor I am referring to was covered in the previous blog article.

PROC 0
ISPEXEC LMINIT DATAID(DV) DATASET(PDS.OBJ)
ISPEXEC LMOPEN  DATAID(&DV)
ISPEXEC LMMDISP DATAID(&DV) COMMANDS(ANY)
ISPEXEC LMCLOSE DATAID(&DV)
EX PDS.CLIST(ABLKED) '&ZLMEMBER 0'
WRITE RETURN CODE IS &LASTCC MEMBER * &ZLMEMBER *

These point and click dialogs makes developing software on the IBM mainframe a breeze. The technician can concentrate on the solving the project problems without perfunctory overhead of the MVS, TSO ISPF and other overhead.

Beolw is a video that demonstrates the tool in action.

This as well as other offerings makes software development on the IBM mainframe a snap. Please do not hesitate to communicate with us in the comments of this post.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS File Conversion Copy Variable To Fixed Records

There are those occasions when file conversions may be necessary. When that time comes simply use a COBOL program to solve the problem.

By placing the programs in the load library makes them available to any required programming situation, The main program simply issues the call and the linkage editor resolves all external references. This approach is what I like to call quick and dirty.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABM00002.                                         00020004
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/15/2014.                                       00050000
000600 DATE-COMPILED. 09/15/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000800 CONFIGURATION SECTION.                                           00080000
000900 SOURCE-COMPUTER. IBM-Z-OS.                                       00090000
001000 OBJECT-COMPUTER. IBM-Z-OS.                                       00100000
001100 DATA DIVISION.                                                   00110000
001200 WORKING-STORAGE SECTION.                                         00120000
001201 01 EOF-SW PIC X.                                                 00120100
001210 01  CMDBUF PIC X(80).                                            00121000
001220 PROCEDURE DIVISION.                                              00122000
001230     MOVE ' ' TO EOF-SW.                                          00123002
001231     CALL 'ABS00002'.                                             00123101
001232     CALL 'ABS00003'.                                             00123203
001233     PERFORM 0010-DO-IO UNTIL EOF-SW NOT EQUAL SPACES.            00123303
001234     CALL 'ABS0002B'.                                             00123405
001235     CALL 'ABS0003B'.                                             00123505
001236     GOBACK.                                                      00123603
001237 0010-DO-IO.                                                      00123703
001238     CALL 'ABS0002A' USING CMDBUF EOF-SW.                         00123803
001239     IF EOF-SW = SPACES THEN                                      00123906
001240         CALL 'ABS0003A' USING CMDBUF.                            00124006

The input sub program is listed below.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00002.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/15/2014.                                       00050000
000600 DATE-COMPILED. 09/15/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000710 INPUT-OUTPUT SECTION.                                            00071000
000720 FILE-CONTROL.                                                    00072000
000730     SELECT V-FILE ASSIGN TO UT-S-VSINP                           00073021
000740     ORGANIZATION IS SEQUENTIAL.                                  00074002
001100 DATA DIVISION.                                                   00110000
001110 FILE SECTION.                                                    00111000
001120 FD  V-FILE                                                       00112005
001121     DATA RECORD IS V-RECORD                                      00112116
001122     RECORDING MODE IS V                                          00112210
001123     RECORD IS VARYING IN SIZE FROM 1 TO 80 CHARACTERS.           00112319
001130 01  V-RECORD PIC X(80).                                          00113015
001200 WORKING-STORAGE SECTION.                                         00120000
001210 LINKAGE SECTION.                                                 00121000
001211 01  EOF-SW PIC X.                                                00121120
001220 01  LSBUF PIC X(80).                                             00122000
001300 PROCEDURE DIVISION.                                              00130020
001310     OPEN INPUT V-FILE.                                           00131006
001400     GOBACK.                                                      00140000
001500     ENTRY 'ABS0002A' USING LSBUF, EOF-SW.                        00150020
001600     READ V-FILE INTO LSBUF                                       00160000
001700         AT END MOVE 'X' TO EOF-SW.                               00170000
001800     GOBACK.                                                      00180000
001900     ENTRY 'ABS0002B'.                                            00190007
002000     CLOSE V-FILE.                                                00200000
002100     GOBACK.                                                      00210000

The output sub program is listed here.

000100 IDENTIFICATION DIVISION.                                         00010000
000200 PROGRAM-ID.    ABS00003.                                         00020000
000300 AUTHOR.        ARCH BROOKS.                                      00030000
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.                    00040000
000500 DATE-WRITTEN.  09/15/2014.                                       00050000
000600 DATE-COMPILED. 09/15/2014.                                       00060000
000700 ENVIRONMENT DIVISION.                                            00070000
000710 INPUT-OUTPUT SECTION.                                            00071000
000720 FILE-CONTROL.                                                    00072000
000730     SELECT F-FILE ASSIGN TO UT-S-FSOUT                           00073000
000740     ORGANIZATION IS SEQUENTIAL.                                  00074000
000750 DATA DIVISION.                                                   00075000
000760 FILE SECTION.                                                    00076000
000770 FD  F-FILE                                                       00077000
000780     DATA RECORD IS F-RECORD                                      00078000
000790     RECORDING MODE IS F.                                         00079000
000900 01  F-RECORD PIC X(80).                                          00090000
001000 WORKING-STORAGE SECTION.                                         00100000
001100 LINKAGE SECTION.                                                 00110000
001200 01  EOF-SW PIC X.                                                00120000
001210 01  LSBUF PIC X(80).                                             00121000
001220 PROCEDURE DIVISION.                                              00122000
001230     OPEN OUTPUT F-FILE.                                          00123000
001240     GOBACK.                                                      00124000
001250     ENTRY 'ABS0003A' USING LSBUF, EOF-SW.                        00125000
001251     WRITE F-RECORD FROM LSBUF.                                   00125100
001280     GOBACK.                                                      00128000
001290     ENTRY 'ABS0003B'.                                            00129000
001300     CLOSE F-FILE.                                                00130000
001400     GOBACK.                                                      00140000

These programs may be easily copied and modified which will make them usable for many input output usages. They have been tested and work flawlessly without much forethought.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS MVS Clist To Invoke Linkage Editor


There are those times when it is beneficial to invoke the linkage editor to make executable programs from compiled object code.

The following clist (command list) for MVS fill the bill exactly.

PROC 2 MEM LE
CONTROL LIST
FREE FI(SYSPRINT, SYSLIB, SYSLIN, SYSLMOD, SYSUT1)
ALLOC FI(SYSPRINT) DA(PDS.LPRT(&MEM)) SHR
ALLOC FI(SYSLIN) DA(PDS.OBJ(&MEM)) SHR
ALLOC FI(SYSLMOD) DA(PDS.LOAD(&MEM)) SHR
ALLOC FI(SYSUT1) UNIT(SYSDA) TRACKS SPACE(10,10) NEW
ALLOC FI(SYSLIB) DA('CEE.SCEELKED') SHR
IF &LE = 0 THEN +
    CALL 'SYS1.LINKLIB(HEWL)' 'XREF,LIST,LET,NCAL'
ELSE +
    CALL 'SYS1.LINKLIB(HEWL)' 'XREF,LIST,LET'
WRITE RETURN CODE IS &LASTCC
FREE FI(SYSPRINT, SYSLIB, SYSLIN, SYSLMOD, SYSUT1)

The first parameter MEM identifies the member to be linked while the second parameter LE indicates whether the module to be linked edited is stand alone executable or a sub program.  Of course thee are different link edit options for stand alone executables and sub programs.

The following shows printed output for the linked sub program.

1z/OS V1 R10 BINDER     17:48:52 TUESDAY SEPTEMBER 16, 2014
 BATCH EMULATOR  JOB(AMBMVS  ) STEP(ISPFLITE) PGM= HEWL      PROCEDURE(ISPFPROC)
 IEW2278I B352 INVOCATION PARAMETERS - XREF,LIST,LET,NCAL
 
 IEW2454W 9203 SYMBOL IGZCBSO UNRESOLVED.  NO AUTOCALL (NCAL) SPECIFIED.
 IEW2454W 9203 SYMBOL CEESTART UNRESOLVED.  NO AUTOCALL (NCAL) SPECIFIED.
 IEW2454W 9203 SYMBOL CEEBETBL UNRESOLVED.  NO AUTOCALL (NCAL) SPECIFIED.
 IEW2454W 9203 SYMBOL ISPEXEC UNRESOLVED.  NO AUTOCALL (NCAL) SPECIFIED.
 IEW2454W 9203 SYMBOL CEESG005 UNRESOLVED.  NO AUTOCALL (NCAL) SPECIFIED.
 
 
1                                       C R O S S - R E F E R E N C E  T A B L E
                                        _________________________________________
 
 TEXT CLASS = B_TEXT
 
 ---------------  R E F E R E N C E  --------------------------  T A R G E T  -------------------------------------------
   CLASS                            ELEMENT       |                                            ELEMENT                  |
   OFFSET SECT/PART(ABBREV)          OFFSET  TYPE | SYMBOL(ABBREV)   SECTION (ABBREV)           OFFSET CLASS NAME       |
                                                  |                                                                     |
       50 ABS00001                       50 V-CON | IGZCBSO          $UNRESOLVED                                        |
       BA ABS00001                       BA V-CON | CEESTART         $UNRESOLVED                                        |
       DA ABS00001                       DA V-CON | CEESTART         $UNRESOLVED                                        |
       DE ABS00001                       DE V-CON | CEEBETBL         $UNRESOLVED                                        |
      128 ABS00001                      128 V-CON | ISPEXEC          $UNRESOLVED                                        |
                                        *** E N D  O F  C R O S S  R E F E R E N C E ***
 
 
 
1PROCESSING OPTIONS:
 
    ALIASES             NO
    ALIGN2              NO
    AMODE               UNSPECIFIED
    CALL                NO
    CASE                UPPER
    COMPAT              UNSPECIFIED
    COMPRESS            AUTO
    DCBS                NO
    DYNAM               NO
    EXTATTR             UNSPECIFIED
    EXITS:              NONE
    FILL                NONE
    GID                 UNSPECIFIED
    HOBSET              NO
    INFO                NO
    LET                 08
    LINECT              060
    LIST                SUMMARY
    LISTPRIV            NO
    MAP                 NO
    MAXBLK              032760
    MODMAP              NO
    MSGLEVEL            00
    OVLY                NO
    PRINT               YES
    RES                 NO
    REUSABILITY         UNSPECIFIED
    RMODE               UNSPECIFIED
    STORENX             NOREPLACE
    STRIPCL             NO
    STRIPSEC            NO
    TERM                NO
    TRAP                ON
    UID                 UNSPECIFIED
    UPCASE              NO
    WKSPACE             000000K,000000K
    XCAL                NO
    XREF                YES
    ***END OF OPTIONS***
 
 
 
1SAVE OPERATION SUMMARY:
 
    MEMBER NAME         ABS00001
    LOAD LIBRARY        AMBMVS.PDS.LOAD
    PROGRAM TYPE        LOAD MODULE
    VOLUME SERIAL       USR005
    MAX BLOCK           6144
    DISPOSITION         REPLACED
    TIME OF SAVE        17.48.53  SEP 16, 2014
 
 
1SAVE MODULE ATTRIBUTES:
 
    AC                  000
    AMODE                31
    COMPRESSION         NONE
    DC                  NO
    EDITABLE            YES
    EXCEEDS 16MB        NO
    EXECUTABLE          YES
    MIGRATABLE          YES
    OL                  NO
    OVLY                NO
    PACK,PRIME          NO,NO
    PAGE ALIGN          NO
    REFR                NO
    RENT                NO
    REUS                NO
    RMODE               ANY
    SCTR                NO
    SSI
    SYM GENERATED       NO
    TEST                NO
    XPLINK              NO
    MODULE SIZE (HEX)   000006D0
 
 
 
 
 
 
1 ENTRY POINT AND ALIAS SUMMARY:
 
  NAME:            ENTRY TYPE AMODE C_OFFSET CLASS NAME        STATUS
 
  ABS00001          MAIN_EP      31 00000000 B_TEXT
 
                          ***** E N D  O F  R E P O R T *****
 
 
 
 
1z/OS V1 R10 BINDER     17:48:52 TUESDAY SEPTEMBER 16, 2014
 BATCH EMULATOR  JOB(AMBMVS  ) STEP(ISPFLITE) PGM= HEWL      PROCEDURE(ISPFPROC)
 IEW2008I 0F03 PROCESSING COMPLETED.  RETURN CODE =  4.
 
 
 
1----------------------
 MESSAGE SUMMARY REPORT
 ----------------------
  TERMINAL MESSAGES      (SEVERITY = 16)
  NONE
 
  SEVERE MESSAGES        (SEVERITY = 12)
  NONE
 
  ERROR MESSAGES         (SEVERITY = 08)
  NONE
 
  WARNING MESSAGES       (SEVERITY = 04)
  2454
 
  INFORMATIONAL MESSAGES (SEVERITY = 00)
  2008  2278
 
 
  **** END OF MESSAGE SUMMARY REPORT ****

The linkage editor listing shows the results of the invoked clist.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.