On 11/11/2006, at 7:57 AM, Michael Rosinger wrote:

We will be migrating COBOL programs from a VSE/ESA system to i5. Many of our COBOL programs have optional input parameters that drive the processing. The
way the majority of them handle the parms is that the parms are coded
"in-line" in the JCL. The program defines the system reader device as a
"file". This technique has proven to be the most flexible since it enables the program to handle 0 to many input parms and keeps "reading" the file until end-of-file (translated that means when the JCL card containing the
"/*" card is read).

So, I would like opinions as to how best to adapt this type of processing to the iSeries world. Is there a way to define the system reader device as a file to the COBOL program which can read in the parameter cards that are
"in-line" in the CL and *know* when to stop (EOF)?

If not, what is the closest method that would require the fewest logic
changes to the existing programs?

This is a very "mainframe" way of doing things. You can accomplish similar behaviour on iSeries by using CL job streams and in-line data files although most iSeries programmers will consider this an archaic, if not downright ugly, technique. See the COBOL Programmer's Guide for information about input data spooling. Here is a trivial example:

First the CL job stream:

//BCHJOB   JOB(BATCHJOB)
CALL       PGM(SHC/BCHJOBCBL)
//DATA     FILE(FILE1) FILETYPE(*DATA) ENDCHAR('/*')
Data for parm 1
Data for parm 2
Data for parm 3
Data for parm 4
/*
//ENDBCHJOB

Next, the COBOL program:

      * THIS PROGRAM IS JUST A SIMPLE EXAMPLE TO DEMONSTRATE
      * PROCESSING AN IN-LINE FILE LIKE MAINFRAME
      *
       IDENTIFICATION DIVISION.
       PROGRAM-ID. BCHJOBCBL.
       AUTHOR. SIMON COULTER.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

           SELECT FILE1
                  ASSIGN       TO DISK-FILE1
                  ORGANIZATION IS SEQUENTIAL
                  ACCESS       IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD  FILE1
           LABEL RECORDS ARE STANDARD.
       01  FILE1-RECORD              PIC X(80).

       WORKING-STORAGE SECTION.

       01 INPUT-END                  PIC X VALUE SPACE.
          88 END-OF-INPUT            VALUE "E".

       PROCEDURE DIVISION.

           OPEN INPUT FILE1.

           READ FILE1 INTO FILE1-RECORD
                AT END SET END-OF-INPUT TO TRUE
           END-READ
           PERFORM UNTIL END-OF-INPUT
              DISPLAY FILE1-RECORD
              READ FILE1 INTO FILE1-RECORD
                   AT END SET END-OF-INPUT TO TRUE
              END-READ
           END-PERFORM.

           CLOSE      FILE1.
           STOP RUN.                                   

Run the CL job stream using the SBMDBJOB command.


Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.