Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to pass variable value from JCL to Cobol DB2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kudamala

New User


Joined: 12 Sep 2008
Posts: 51
Location: Bangalore

PostPosted: Wed Feb 11, 2009 11:08 am    Post subject: How to pass variable value from JCL to Cobol DB2 program
Reply with quote

Hi

I have some problem in passing parameter value from jcl to program.
My requirement is; I have a cobol-DB2 program that fetches data from DB2 table based on the vendor name. I should get the vendor name from JCL. We have one JCL where we set the vendor name, and call the proc. as follows:

//xyz JOB jobcard details
// JCLLIB ORDER=(XYS.ABC.DEF)
// SET HLQ=DEV
// SET PRE=T
// SET LVL=D
// SET VEN=ABCD
//JOBLIB DD DSN=DEV.PGM.LOAD,DISP=SHR
// INCLUDE MEMBER=XXX1111

In include member XXX1111

// SET CONTROL=XYZ1234
//STEP010 EXEC PGM=IKJEFT1B,
// PARM='UTL00000 PGM=DUPLICAT,HLQ=&HLQ,LVL=&LVL,PRE=&PRE',
// DYNAMNBR=20,
// COND=(0,NE)
// INCLUDE MEMBER=UTL01CI1
//STEP020 EXEC PGM=IKJEFT1B,
// DYNAMNBR=20,
// COND=(0,NE)
//FS DD DSN=&HLQ..XYZ.EXTRACT.&VEN..TEMP,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(150,75),RLSE),
// LRECL=95,
// RECFM=FB
//SYSOUT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=U
//SYSTSIN DD DSN=&HLQ..DUPL.PARMLIB(XYZ1234),
// DISP=SHR

The control card XYZ1234 is as follows:

DSN SYSTEM(DB2&PRE) RETRY(2)
RUN PLAN(&LVL.EUMN0) PROGRAM(EUM403P1) -
LIBRARY('&HLQ..PGM.LOAD') -
PARMS('&VEN')
END

Could any body help, what is the problem in this JCL parm?
when I display the vendor name it shows &VEN instead of ABCD

Thanks in advance
Ravi
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Feb 11, 2009 11:25 am    Post subject:
Reply with quote

Are the other symbolic parameters being substituted correctly? Please show your expanded JCL as it appears in JESJCL or whatever it's called.
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Wed Feb 11, 2009 12:56 pm    Post subject:
Reply with quote

Hi Ravi,

Have you tried with removing single quotes in PARMS?

I am thinking that since you mentioned the &VEN in single quotes system might be considering it as a string icon_smile.gif

Regards,
Mallik
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Wed Feb 11, 2009 1:10 pm    Post subject:
Reply with quote

why would you expect the contents of &HLQ..DUPL.PARMLIB(XYZ1234) to undergo substitution?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Wed Feb 11, 2009 2:28 pm    Post subject:
Reply with quote

your sysin contains the following:
Code:

DSN SYSTEM(DB2&PRE) RETRY(2)
RUN PLAN(&LVL.EUMN0) PROGRAM(EUM403P1) -
LIBRARY('&HLQ..PGM.LOAD') -
PARMS('&VEN')


I would break the above into several members of the parmlib, and then use the symbolic as the member name for a concatenated sysin:
Code:

//SYSTSIN DD DSN=&HLQ..DUPL.PARMLIB(&pre.sys),
// DISP=SHR

    this would contain
   DSN SYSTEM(DB2T) RETRY(2)

//        DD DSN=&HLQ..DUPL.PARMLIB(&lvl.plan),
// DISP=SHR

      this would contain
   RUN PLAN(DEUMN0) PROGRAM(EUM403P1) -


//       DD DSN=&HLQ..DUPL.PARMLIB(&hlq.lib),
// DISP=SHR

       this would contain
    LIBRARY('DEV.PGM.LOAD') -


//         DD DSN=&HLQ..DUPL.PARMLIB(&ven.parm),
// DISP=SHR

      this would contain
     PARMS('ABCD')

//SYSTSIN DD DSN=&HLQ..DUPL.PARMLIB(END),
// DISP=SHR

      this would contain
     END



in effect, you would have to generate a hardcode parm
for each potential symbolic,
then use the symbolic to create the member name.


by the way, not sure if PARMS is the correct spelling, could be just PARM, but I am not going to look it up.
Back to top
View user's profile Send private message
kudamala

New User


Joined: 12 Sep 2008
Posts: 51
Location: Bangalore

PostPosted: Wed Feb 11, 2009 2:41 pm    Post subject: Reply to: How to pass variable value from JCL to Cobol DB2 p
Reply with quote

Thanks to all.

I have just removed the COND parameter, it is working now.

once again thanks to Ibmmainframes.com and its members for helping time to time

Regards
Ravi
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Feb 12, 2009 1:06 am    Post subject:
Reply with quote

"...not sure if PARMS is the correct spelling, could be just PARM..."
It USED to be PARMS but last time I used it, PARM is acceptable also.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Feb 12, 2009 1:08 am    Post subject:
Reply with quote

I don't see how removing the COND parameter fixed your problem. Could you show us your working JCL for the benefit of others?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us