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
 

 

Write records to dataset using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Wed Nov 20, 2013 12:14 pm    Post subject: Write records to dataset using JCL
Reply with quote

Hi all,

I would like to know if and how we can write records to a dataset using just JCL.

Scenario:

Lets say, these 3 Files were sent via FTPS in the previous steps:

FILE1_%%$ODATE.%%TIME
FILE2_%%$ODATE.%%TIME
FILE3_%%$ODATE.%%TIME

Requirement:

Once all 3 files are transferred, we have to send them a so-called "flagfile". This flagfile must contain the 3 filenames, so that the downstream application knows, what filenames we sent to them, since %%$ODATE and %%TIME are Control-M Variables and can change after each run.

The JCL would look like this:

//* Send FILE1_%%$ODATE.%%TIME
//STEP1 EXEC PGM=FTPSPROC
....
//* Send FILE3_%%$ODATE.%%TIME
//STEP2 EXEC PGM=FTPSPROC
....
//* Send FILE3_%%$ODATE.%%TIME
//STEP3 EXEC PGM=FTPSPROC
....
//* Generate Flagfile FLAG_FILE
//STEP4 EXEC PGM=???
??????
//* Send FLAG_FILE
//STEP5 EXEC PGM=FTPSPROC
??????

I would like to avoid to write a very simple program for this.

Hopefully I am clear enough with the requirement.

Many thanks in advance.

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

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Nov 20, 2013 12:25 pm    Post subject:
Reply with quote

Quote:
I would like to avoid to write a very simple program for this.


Cant you handle these through return codes?
Back to top
View user's profile Send private message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Wed Nov 20, 2013 12:36 pm    Post subject:
Reply with quote

Quote:
Cant you handle these through return codes?


I'm not sure, how I can create the flag file with returncodes. But of course, each step does have a returncode handling. I just didnt write it..

So its like the ff:

//* Send FILE1_%%$ODATE.%%TIME
//STEP1 EXEC PGM=FTPSPROC
....
//* Send FILE3_%%$ODATE.%%TIME
// IF RC = 0 THEN
//STEP2 EXEC PGM=FTPSPROC
....
// ENDIF
//* Send FILE3_%%$ODATE.%%TIME
// IF RC = 0 THEN
//STEP3 EXEC PGM=FTPSPROC
....
// ENDIF
//* Generate Flagfile FLAG_FILE
// IF RC = 0 THEN
//STEP4 EXEC PGM=???
??????
// ENDIF
//* Send FLAG_FILE
// IF RC = 0 THEN
//STEP5 EXEC PGM=FTPSPROC
...
// ENDIF
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Nov 20, 2013 1:35 pm    Post subject:
Reply with quote

Considering that STEP1,STEP2 and STEP3 gets the filenames to be transmitted after the substitution of %%$ODATE and %%TIME just before submission, would it be possible that the STEP4 has instream data just like the example below that could also be substituted? This would get you the file names in the SORTOUT?

Code:

//*                               
//STEP4 EXEC  PGM=SORT           
//SYSOUT    DD  SYSOUT=*           
//SORTIN DD *                     
FILE1_%%$ODATE.%%TIME             
FILE2_%%$ODATE.%%TIME             
FILE3_%%$ODATE.%%TIME             
//SORTOUT DD  DSN=XXXXX.XXXXXX,   
//      DISP=(,CATLG,DELETE),     
//      SPACE=(CYL,(100,100),RLSE),
//      RECFM=FB,LRECL=80         
//SYSIN    DD    *                 
  OPTION COPY                     
//*                               


Thanks,
Ashwin.
Back to top
View user's profile Send private message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Wed Nov 20, 2013 1:58 pm    Post subject: Reply to: Write records to dataset using JCL
Reply with quote

Hi Ashwin,

That's it.. You're example worked..

Many thanks.. icon_biggrin.gif

Regards,
cima
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1717
Location: UK

PostPosted: Wed Nov 20, 2013 2:56 pm    Post subject:
Reply with quote

100 cylinders for 3 80 byte records? You must be joking.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Nov 20, 2013 3:05 pm    Post subject:
Reply with quote

Nic might be due to copy paste issue icon_smile.gif
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Nov 20, 2013 3:06 pm    Post subject:
Reply with quote

Quote:

That's it.. You're example worked..


Good to hear icon_smile.gif


Quote:

100 cylinders for 3 80 byte records? You must be joking.


It was an example which I picked from an old template I had. Thanks Nic for pointing that out icon_smile.gif

Thanks,
Ashwin.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Nov 20, 2013 3:14 pm    Post subject:
Reply with quote

Quote:

Nic might be due to copy paste issue


Bingo! icon_biggrin.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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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