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

How to pass variable value from JCL to Cobol DB2 program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 6966
Location: porcelain throne

PostPosted: Wed Feb 11, 2009 1:10 pm
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: 6966
Location: porcelain throne

PostPosted: Wed Feb 11, 2009 2:28 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top