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

Write records to dataset using JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Wed Nov 20, 2013 12:25 pm
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
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: 74
Location: Boston

PostPosted: Wed Nov 20, 2013 1:35 pm
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
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: 2455
Location: Hampshire, UK

PostPosted: Wed Nov 20, 2013 2:56 pm
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

Global Moderator


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

PostPosted: Wed Nov 20, 2013 3:05 pm
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: 74
Location: Boston

PostPosted: Wed Nov 20, 2013 3:06 pm
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: 74
Location: Boston

PostPosted: Wed Nov 20, 2013 3:14 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top