SET parameter not working



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

SET parameter not working

Postby 85mcLaren » Tue Aug 18, 2009 5:41 pm

I am fairly new to JCL so be a little easy on me.... :oops:

I have the following code grabbing the date.

I can reference the &LYYMMDD anywhere in the code and it tranlates fine. The problem is I need to save the value in a set statement.

//STEP00 EXEC PGM=EZACFSM1
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DATA,DLM=@@
// SET DTVAR=D&LYYMMDD
@@

I am trying to write this value out to a file(member). It appears that the set variable cannot be referenced in the SYSUT2 parameter of IEBGENER. Weird thing is - the &LYYMMDD CAN BE referenced in the SYSUT2, but I need this value to be stateful.

//STEP01 EXEC PGM=IEBGENER
// SET DTVAR=&LYYMMDD
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD *
PUT //&DTVAR
//*
//SYSUT2 DD DSN=XXXX.XXXX.XXXX(XXXDT1),DISP=SHR
//*

I have tried moving the set parameter in other places - thinking the set parameter is not being held in the SYSIN of the EZACFSM1 program, but it is in fact being held - as I can reference it in a DD DSN statement and it substitues fine.

Is there another program besides IEBGENER I could use that would take the SET statement or am I missing something here.... ALL suggesstions are obviously welcome. I probably would want to stay with JCL and not REXX, but please reply with what you will. I will listen and comment to any solution...

Thanks,
Jason
85mcLaren
 
Posts: 4
Joined: Mon Aug 17, 2009 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby MrSpock » Tue Aug 18, 2009 6:34 pm

I'm trying to understand what you want to do here, but I am a bit confused so bear with me.

&LYYMMDD is a dynamic system variable. There are only a few programs that know how to translate it into it's actual value. EZACFSM1 is one, SORT is one, and a program written in REXX can also.

If you want to create a SET command with a value for the local date and store it in a PDS member, did you try this:

//STEP00 EXEC PGM=EZACFSM1
//SYSOUT DD DSN=XXXX.XXXX.XXXX(XXXDT1),DISP=SHR
//SYSIN DD DATA,DLM=@@
// SET DTVAR=D&LYYMMDD
@@

or this

//STEP00 EXEC PGM=SORT
//SORTIN DD *

/*
//SORTOUT DD DSN=XXXX.XXXX.XXXX(XXXDT1),DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1:C'// SET DTVAR=D',CDATE,80:X)
/*
//SYMNAMES DD *
CDATE,S'&LYYMMDD'
/*
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: SET parameter not working

Postby 85mcLaren » Tue Aug 18, 2009 6:53 pm

Thanks MrSpock for the reply. I need to save it in a set variable because further down in the job, I need to do other work with the same date/time field. The code above is just part of the big piture. I am storing that variable to use as a file name. For instance, it will be used as a file name to create a member (DSN=xxx.xxx.xxx(&DTVAR) in a dataset. Then it will used later as above to populate the member name in a control card to FTP.
Something like:

FTP xxx.xxx.xxx.xxx
Put XXX.XXX.XXX.&DTVAR 'TEST&DTVAR'
etc.


ETC.

That is why I need to store it as a SET parameter. I am also including the Time with it as well. so I can't simply just use the date without it being stored as a SET paramter as the time will increment each time I 'grab' it from EZACFSM1. I just used the date in my code for simplicity.

Does it make any more sense.... ??

Thanks,
Jason
85mcLaren
 
Posts: 4
Joined: Mon Aug 17, 2009 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby MrSpock » Tue Aug 18, 2009 8:37 pm

85mcLaren wrote:Does it make any more sense.... ??


Not really. The SET statement for JCL is usually coded at the top of the job right after the JOB and/or INCLUDE statements. The SET statement defines values for user-defined variables to be used in the job during run-time execution. Don't forget that all JCL has to be submitted through the JES Internal Reader, which scans the code and resolves any specified variables BEFORE the job is placed onto the JES spool for execution. Any SET statements you create in one job can only be used by a subsequent job.

Honestly, if all you want to do is generate date/time values for FTP processes, I think using SET statements is a bit of overkill. Why can't you just use EZACFSM1 or SORT or some other comparable program to dynamically build your PUT statements as needed:

//STEP00 EXEC PGM=EZACFSM1
//SYSOUT DD DSN=&&TEMP,DISP=(,PASS),UNIT=VIO
//SYSIN DD *
put //dd:ddname 'TEST.D&LYYMMDD.T&LHHMMSS'
/*
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: SET parameter not working

Postby 85mcLaren » Tue Aug 18, 2009 10:55 pm

The biggest problem is with:

//STEP00 EXEC PGM=EZACFSM1
//SYSOUT DD DSN=&&TEMP,DISP=(,PASS),UNIT=VIO
//SYSIN DD *
put //dd:ddname 'TEST.D&LYYMMDD.T&LHHMMSS'
/*

is then the time stamp is 'grabbed'....

What if I want to create a member right above this step with the same dataset name which is:

'TEST.D&LYYMMDD.T&LHHMMSS'

Unless I can store that value before the creation of the dataset, the next chunk of code that will run (which is the FTP chunk that you have above, will grab another time stamp. There the file that is trying to FTP will not exist.
File creation will be something like
'TEST.D090817.T132209', BUT when it gets to the next step and
referrences those values again - the file will be something like
'TEST.D090817.T132212'

You can see that the seconds will prbably change - so the files will never match if trying to reference .D&LYYMMDD.T&LHHMMSS' throughout the program.

BUT - if I can store the date/time in a beginning step like:

// SET DTVAR = 'TEST.D&LYYMMDD.T&LHHMMSS',

Then I can reference this variable anywhere and it will be the same....

Is what I am saying any clearer now ?

Thanks,
Jason
85mcLaren
 
Posts: 4
Joined: Mon Aug 17, 2009 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby arcvns » Wed Aug 19, 2009 9:59 pm

File creation will be something like
'TEST.D090817.T132209', BUT when it gets to the next step and
referrences those values again - the file will be something like
'TEST.D090817.T132212'
85mcLaren,

I have a question here. Now that you've created your FTP card with filename as 'TEST.D090817.T132209', would n't it be sufficient to just run the FTP step to get the file created as 'TEST.D090817.T132209'. Why do you want to reference the time one more time? Let me know if I am missing something here.
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby 85mcLaren » Wed Aug 19, 2009 10:40 pm

The problem is - I have not completed the FTP control card correctly.

The first action I perform is to create a member in a dataset. This will be the first time I reference the system variable of &LYYMMDD and create a SET variable from it named DTVAR. (SET DTVAR=&LYYMMDD)

The next step will be to populate that member. That will work fine as the DSN statement will let me reference the SET variable I created above (&DTVAR).

Then, later, I want to create an FTP control card that will include the FTP statement like:
FTP xxx.xxx.xxx.xxx
cd /xxx/xxx/xxx
PUT xxx.xxx.xxx(&DTVAR) 'test.&DTVAR
QUIT

I would typically use IEBGENER using SYSUT1 * and adding those instream commands above to put into the control card of FTPDT1 through SYSUT2 .

Problem is in using SYSUT1 from my statments above - how can I reference my SET variable of DTVAR. SYSUT1 will not let me reference the value in the SET variable like the DSN will let me.

Make sense ?

Thanks,
Jason
85mcLaren
 
Posts: 4
Joined: Mon Aug 17, 2009 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby mfrookie » Tue May 03, 2011 3:22 pm

Hi,

I am not sure if I have understaood your problem correctly, but if it is the way I interpret it, then can this be tried.

1) We assign 1st symbolic variable the timestamp value.
2) We SET 2nd symbolic variable which will be set to 1st symbolic variable. This way 2nd variable will always have the timestamp that was obtained and will be static thru out the life of the JOB.

//STEP0000 EXEC PGM=EZACFSM1,COND=(0,NE)                   
//SYSOUT   DD SYSOUT=*                                     
//SYSIN DD DATA,DLM=@@                                     
// SET DTVAR=D&LYYMMDD                                     
// SET TMVALUE=&DTVAR                                       
@@                                                         
//                                                         


Here symbolic variable TMVALUE will always refer to the timestamp and then we use TMVALUE down the line which will always be static.

Another option is to store timestamp in SORT's SYMNAMES dataset and build the JCL statements dynamically using it. This way we can refer it multiple times.
mfrookie
 
Posts: 40
Joined: Mon Apr 25, 2011 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SET parameter not working

Postby mfrookie » Tue May 03, 2011 4:31 pm

Sorry, I was searching something and stumbled upon this thread, did not realize that its a 2 yer old thread. :)
mfrookie
 
Posts: 40
Joined: Mon Apr 25, 2011 8:46 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post