IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to pass a parameter from JCL to CLIST program?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Red Rabbit

New User


Joined: 06 Apr 2006
Posts: 5
Location: Kolkata

PostPosted: Thu Apr 06, 2006 5:49 pm
Reply with quote

I want to check in my CLIST program whether a dataset exists or not. However, this dataset would not be known in advance. It (dataset name)needs to be passed through the JCL at the time of execution to the CLIST program.
Currently I am using the IKJEFT utility to execute CLIST program through JCL, but I don't know how to pass parameter through it.

Can anybody help.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Apr 06, 2006 6:02 pm
Reply with quote

Presuming that you have the parameter list in your CLIST:

PROC 1 DSN
WRITE &DSN

Then, the program is called

//STEP1 EXEC PGM=IKJEFT01,PARM='%CLIST MY.DSN.TO.CHK'
Back to top
View user's profile Send private message
Red Rabbit

New User


Joined: 06 Apr 2006
Posts: 5
Location: Kolkata

PostPosted: Thu Apr 06, 2006 7:09 pm
Reply with quote

Hi superk,

Thanx for your reply.

I suppose in the line:
Quote:
//STEP1 EXEC PGM=IKJEFT01,PARM='%CLIST MY.DSN.TO.CHK'


%CLIST was supposed to be the CLIST program name preceded by '%'!!

However, when I tried it gave the following message:
Code:
IKJ56716I EXTRANEOUS INFORMATION WAS IGNORED: MYDSN.TEMP.FILE


Also, it did not recognize the dataset as an existing one, though the dataset exists.


May be, having a look at the CLIST program and my JCL would give you a better idea:

CLIST program looks somewhat like:
Code:
PROC 0                           
IF &SYSDSN(&DSN) = OK THEN +     
  DO                             
  SET &RC = 3                   
  END                           
ELSE +                           
  DO                             
  SET &RC = 4                   
  END                           
EXIT CODE(&RC)                   


And the JCL:
Code:
//JS0010   EXEC PGM=IKJEFT1B,DYNAMNBR=20,PARM='%DSNCHK MYDSN.TEMP.FILE'
//SYSPROC  DD DSN=SYSLIB.DEV.CLIST.LIB,DISP=SHR                 
.
.
.
//SYSTSIN  DD DSN=MYDSN.TEST5.JCL(CNTLCRD),DISP=SHR
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Apr 06, 2006 9:01 pm
Reply with quote

Have you reviewed the information in Chapter 2.3.1 Passing Parameters to CLISTs in the z/OS V1R7.0 TSO/E CLISTs manual?
Back to top
View user's profile Send private message
Red Rabbit

New User


Joined: 06 Apr 2006
Posts: 5
Location: Kolkata

PostPosted: Fri Apr 07, 2006 10:26 am
Reply with quote

I got my mistake. Actually I forgot to mention the parameter list with the PROC statement. (See the code).

For those who are visiting this post regarding similar query, here is the way how to pass a parameter to the CLIST program through JCL:

In the CLIST program, we need to mention the number of parameters to be passed followed by the variables supposed to take those parameters in the PROC.
e.g.,
Code:
PROC 2 DSN1 SN2


The above lilne indicates that there would be two parameters passed to this CLIST program and the first would be stored in the variable DSN! and the second in DSN2.

For the JCL part, we need to mention the parameter values right after the CLIST prgram name.
e.g., if our CLIST program name is CHKPRG, then
Code:
%CHKPRG HLQ.MYDSN1 HLQ.MYDSN2


The above line would pass the values HLQ.MYDSN1 and HLQ.MYDSN2 to the CLIST program CHKPROG
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top