Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Copy Current Date to A PS File thru JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to Copy Current Date to A PS File thru JCL
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

Senior Member


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

PostPosted: Tue Jan 20, 2009 2:21 pm    Post subject:
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    Post subject: Reply to: How to Copy Current Date to A PS File thru JCL
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: 2165
Location: @my desk

PostPosted: Tue Jan 20, 2009 6:06 pm    Post subject:
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

Senior Member


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

PostPosted: Tue Jan 20, 2009 6:16 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Jan 21, 2009 6:18 am    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Wed Jan 21, 2009 12:52 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 1:07 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 3:07 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 5:18 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 6:31 pm    Post subject:
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    Post subject: Reply to: How to Copy Current Date to A PS File thru JCL
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 7:22 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 21, 2009 7:50 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us