1

I need to pass data from SYSIN JCL to PL/I program. Below is my code from JCL and PL/I program and values are not being passed. Can anyone help please?

//SYSIN DD *
12345

PROG: PROC(INPARM) OPTIONS(MAIN REENTRANT) REORDER;
DCL INPARM            CHAR(5) VARYING;

PUT SKIP LIST('INPARAM - '|| INPARM);
cschneid
  • 10,237
  • 1
  • 28
  • 39

1 Answers1

5

The PL/1 code you show does not read any file, it only consumes the PARM data. I assume by mainframe you mean IBM z/OS? On z/OS, PARM data is passed via EXEC PGM=xyz,PARM=, and this data can be up to 100 characters. So, redefine the INPARM variable as CHAR(100) VARYING.

SYSIN as shown is a data set definition; the program needs to define, open, and read a data set with ddname (file name) SYSIN. You also need to define an end-of-data flag, and define an ON condition that is triggered when all data from SYSIN has been read.

Here is some code snippet:

DCL SYSIN FILE EXTERNAL RECORD INPUT ENVIRONMENT(FB RECSIZE(80));
DCL INPUT_RECORD CHAR(80);
DCL EOF_SYSIN BIT(1) INIT('0'B);

ON ENDFILE(SYSIN) BEGIN;
    EOF_SYSIN = '1'B;
    END;

OPEN FILE(SYSIN);

DO WHILE (¬EOF);
    ... process the record just read ...
    READ FILE(SYSIN) INTO(INPUT_RECORD);
    END;

CLOSE FILE(SYSIN);

phunsoft
  • 2,674
  • 1
  • 11
  • 22
  • Hi I am trying to pass data from SYSIN from JCL not through file or through parm – Gagandeep Singh Randhawa May 27 '22 at 15:26
  • 1
    Well, SYSIN data, i.e. data that follows a `//SYSIN DD *` statement in the JCL is a kind of temporary data set (temporary file). For programs, there is no difference between reading SYSIN data, i.e. a temporary data set or reading from a permanent data set. Both have to be treated like data sets from the programming point of view. – phunsoft May 28 '22 at 10:18
  • Your code snipped **does** read the PARM data; it does nothing with files at all. – phunsoft May 28 '22 at 10:19