deepaklearner
deepaklearner

Reputation: 161

Passing multiple line value from JCL instream to Cobol variable 88

Example:

01  VAR1             PIC 9(05).      
    88 WS-VAR1  VALUE 1000 1001 1002 1003      
       1004 1009 2000 2002 3000 4000 4009           
       5000 5001 6000 7000 8000 2332 8484.

How can we pass value from JCL as instream to a Cobol program variable 88. So, that it will be easier to modify the value without changing the program.

Two solutions which I found:
1. Using internal indexed table. So that Binary search will do the task fast.
2. Using VSAM file instead of passing data instream. (Less likely)

I think Binary search definitely be slower than 88 condition check. I am trying to find something of equivalent efficiency as of 88 condition check.

Upvotes: 1

Views: 1390

Answers (1)

Hogstrom
Hogstrom

Reputation: 3761

It sounds like you want to pass a value from JCL PARM= or from SYSIN to make the COBOL program independent of a hard coded value.

This web article has a good explanation of how you can accomplish this.

JCL looks like this:

//* ******************************************************************* 
//* Step 2 of 4, Execute the COBOL program with a parameter. //*
//PARJ1S02 EXEC PGM=CBLPARC1, 
//             PARM='This is a Parameter from the EXEC and PARM= ...'

and in the COBOL program linkage section:

  *****************************************************************
   LINKAGE SECTION.
   01  PARM-BUFFER.
       05  PARM-LENGTH         pic S9(4)   comp.
       05  PARM-DATA           pic X(256).

In your case you can validate the data passed in the linkage section based on your criteria. So, once validated, you could move the value from the linkage section after converting it to a numeric value for the test.

Upvotes: 5

Related Questions