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

How to Copy Current Date to A PS File thru JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Tue Jan 20, 2009 1:11 pm
Reply with quote

How to Copy Current Date to A PS File thru JCL(Without Instream Option)?

For Ex:I will be having a Varible called LASTSATDATE in job which will get a value from COntrolM and I want this to be used as Parm or control-card for the program. IF I used it as a Instream in a job processor group for the job not getting generated and element is getting transfered back to test
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jan 20, 2009 2:21 pm
Reply with quote

Hi,

'am not very sure what "For Ex" part of your post is asking, however to get system date in PS (QSAM) you might use this:
Code:
//STEP002 EXEC PGM=ICEMAN                                         
//SYSOUT  DD  SYSOUT=*                                           
//SORTIN  DD *                                                   
//SORTOUT DD DSN=XXXXXX.TEST.SYSTEM.DATE,DISP=(NEW,CATLG,CATLG) 
//SYSIN   DD    *                                                 
  OPTION COPY                                                     
  OUTFIL REMOVECC,NODETAIL,                                       
    TRAILER1=(DATE=(MD4-))                                       
/*                                                               
//*                                                               
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Tue Jan 20, 2009 2:37 pm
Reply with quote

I have to copy the date filed into ps file every week so i have coded a jcl for getting the required date as mentioned below..,

Code:
//*        %%SET %%CURRENT = %%SUBSTR %%DATE 1 1             
//*      %%IF %%CURRENT EQ 9                               
//*       %%SET %%CENT = 19                               
//*      %%ELSE                                       
//*      %%SET %%CENT = 20                               
//*      %%ENDIF                                         
//*     %%SET %%DX1 = %%CALCDATE %%ODATE -6               
//*     %%SET %%DM1 = %%SUBSTR %%DX1 3 2                   
//*     %%SET %%DD1 = %%SUBSTR %%DX1 5 2                   
//*     %%SET %%DY1 = %%SUBSTR %%DX1 1 2                   
//*     %%SET %%LASTSAT = %%DY1%%.%%DM1%%.%%DD1           

----------------------------

Given override in the job to copy into flat file

Code:
//PSTEP010.SYSUT1 DD *   
NORMAL                   
%%LASTSAT%%.05060708091011
//*                       

Proc:

Code:
//PSTEP010 EXEC PGM=IEBGENER                                   
//SYSOUT   DD  SYSOUT=*                                         
//SYSPRINT DD  SYSOUT=*                                         
//SYSUT1   DD  DUMMY,DCB=(BLKSIZE=0,LRECL=80,RECFM=FB)         
$/PSTEP010.SYSUT1 DD *                                         
//SYSUT2   DD  DSN=DATEPARM.FILE,
//             DISP=(NEW,CATLG,DELETE),                         
//             DCB=(BLKSIZE=0,LRECL=80,RECFM=FB),               
//             UNIT=SYSDA,SPACE=(TRK,(2,2),RLSE)               
//SYSIN    DD  DUMMY                                           
//*                                                             

I am using the variable %%LASTSAT as instream for copying into PS file. However it's working fine for testing purpose but while trying to promote production, element got transferred to test saying that instream not allowed.

Is there any other way to do this?


Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jan 20, 2009 6:06 pm
Reply with quote

gopinath,

I am quite not sure of what you're trying to achieve here. What is the content of your 'DATEPARM.FILE' after the execution of above job?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jan 20, 2009 6:16 pm
Reply with quote

Hello,

Instream Data is not allowed in PROCs, may be this is the reason whay this
Quote:
element got transferred to test saying that instream not allowed
comes.

And please tell us (to me at least), What do you expect from this code
Code:
//*        %%SET %%CURRENT = %%SUBSTR %%DATE 1 1             
//*      %%IF %%CURRENT EQ 9                               
//*       %%SET %%CENT = 19                               
//*      %%ELSE                                       
//*      %%SET %%CENT = 20                               
//*      %%ENDIF                                         
//*     %%SET %%DX1 = %%CALCDATE %%ODATE -6               
//*     %%SET %%DM1 = %%SUBSTR %%DX1 3 2                   
//*     %%SET %%DD1 = %%SUBSTR %%DX1 5 2                   
//*     %%SET %%DY1 = %%SUBSTR %%DX1 1 2                   
//*     %%SET %%LASTSAT = %%DY1%%.%%DM1%%.%%DD1           
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Tue Jan 20, 2009 6:29 pm
Reply with quote

Thanks for the reply.

NDVR IS NOT ALLOWING INSTREAM DATA IN the JOB itself that's the reason job got transferred to test.

Job runs on every fri day. Need to get last saturday date from the code and update the same in ps file.

DATEPARM.FILE should contain the below data for this week

Code:
NORMAL             
09011405060708091011


Next week, should be

Code:
NORMAL             
09012105060708091011


Is there any other way to do this?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jan 21, 2009 6:18 am
Reply with quote

Hi,

the override statement should be included inside the job that executes the PROC and not inside the PROC.

Also you cannot resolve Control-M variables in a PROC.



Anuj: the code is using Control-M auto edit variables to obtain last Saturday's date. The code is fine.


Gerry
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 11:21 am
Reply with quote

gcicchet,

I am able to copy last saturday date into a PS file in above method i mentioned.

Only issue in this method, NDVR is not allowing INSTREAM DATA in the JOB saying "instream not allowed".

Is there any method other than the above to get the last saturday date?

Can we get with EZACFSM1 ?

Thanks in advance.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Wed Jan 21, 2009 12:52 pm
Reply with quote

Thanks Gerry - I do not use Contol-M so was not aware of it's coding and asked.. icon_redface.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 1:07 pm
Reply with quote

What about a REXX step using the Control M variable in the PARM statement ?

*** UNTESTED - as we use TWS ***

Code:

//STEP0020 EXEC PGM=IKJEFT01,DYNAMNBR=256,
//           PARM='Rexx_name %%LASTSAT%%.05060708091011 '     


Which would resolve the variable in the PARM statement because it is in the JCL and then be processed in the REXX statements to write to a file.

Code:

/* REXX                    */
ARG DATEBIT .
QUEUE DATEBIT
"EXECIO "QUEUED()" DISKW ddname ( FINIS"
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 3:04 pm
Reply with quote

could you please elaborate the piece of code what it does?

Code:
/* REXX                    */
ARG DATEBIT .
QUEUE DATEBIT
"EXECIO "QUEUED()" DISKW ddname ( FINIS" 
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 3:07 pm
Reply with quote

It reads the value from the PARM in the EXEC card and then writes it out to whatever is allocated to the DD ddname
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 5:08 pm
Reply with quote

expat,

I don't know REXX. Please provide me the sample example. Will test and let you know.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 5:18 pm
Reply with quote

Quote:
Will test and let you know.

Good, as the concept has been tested, just the Control M needs to be tested.

The JCL
Code:

//STEP0020 EXEC PGM=IKJEFT01,
//           PARM='Rexx_name %%LASTSAT%%.05060708091011 ' 
//SYSEXEC  DD DSN=PDS where Rexx_name lives,DISP=SHR         
//STRUC    DD DSN=Dataset name for output,DISP=SHR
//SYSOUT   DD SYSOUT=*                     
//SYSTSPRT DD SYSOUT=*                     
//SYSTSIN  DD DUMMY                         


So the REXX code, stored in member Rexx_name (Or whatever you want to call it) in the PDS above will be
Code:

/* REXX                    */
ARG DATEBIT .
QUEUE DATEBIT
"EXECIO "QUEUED()" DISKW STRUC ( FINIS"
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 6:27 pm
Reply with quote

expat,

Thank you.

I tested the code and it's working fine.

Removed '.' in b/n lastsat filed and numeric data and tested.

Code:
PARM='Rexx_name %%LASTSAT%%05060708091011 '


Output file is writting only date part.

My output file should be like this.

Code:
NORMAL             
09011405060708091011
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 6:31 pm
Reply with quote

OK, change the REXX to this
Code:

/* REXX                    */
ARG DATEBIT AN1 AN2 AN3 .
QUEUE DATEBIT
"EXECIO "QUEUED()" DISKW STRUC ( FINIS"
Say DATEBIT AN1 AN2 AN3


And let me know what the output.
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 7:17 pm
Reply with quote

STRUC DDname output

Code:
0901175060708091011


SYSTSPRT ddname output:

Code:
0901175060708091011
READY               
END                 
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 7:22 pm
Reply with quote

Aaaaaaaaaaaaaaaaaaaaaaaaaaaah, just seen what you want. Sorry I missed it first time around but I'm a bit busy icon_confused.gif

Try this
Code:

/* REXX                    */
ARG DATEBIT .
QUEUE "NORMAL"
QUEUE DATEBIT
"EXECIO "QUEUED()" DISKW STRUC ( FINIS"
Back to top
View user's profile Send private message
gopinath

New User


Joined: 19 Jan 2004
Posts: 9
Location: Chennai

PostPosted: Wed Jan 21, 2009 7:31 pm
Reply with quote

Thank you very much...expat.

It's working.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jan 21, 2009 7:50 pm
Reply with quote

No problems, invoice is in the mail icon_lol.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 5
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
Search our Forums:

Back to Top