MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding date to file name that is being FTP'd.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Thu Jul 22, 2004 10:00 pm    Post subject: Adding date to file name that is being FTP'd. Reply with quote

Hey Guys,

We have a job that FTP's a certain file everyday. In order to differentiate the files being sent ,we have to append the date to the file name being FTP'd.
The parm used by FTP contains the following info :

server name
password
PUT 'aaaaaaaa.bbbbbbbb.ccc' filename.txt quit

This is what I did:

My first data set contains :
server name
password

I used a sort step something like this to append the date to the file name and write it to data set 2.

//********************************************************
//STEP01 EXEC PGM=SORT
//********************************************************
//SORTIN DD *
PUT 'aaaaaaaa.bbbbbbbb.ccc' filename
/*
//SORTOUT DD DSN=xxx.yyy.zzz,(disp=shr)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,36,DATE1,C'.txt',32X)
/*
//SYSOUT DD SYSOUT=*

My third data set contains:
quit

I had a IEBGENER step that would concatenate the above three data sets and copy it to the parm member that would be later used by the FTP step.
The output from IEBGENER step would look something like this :

server name
password
PUT 'aaaaaaaa.bbbbbbbb.ccc' filename20040722.txt
quit


Finally I had the FTP step which would use this parm member to FTP the file.

My question is can we achieve this in a single sort step without having to go thru all the tedious steps that I have mentined above Confused I am rephrasing my question, can we have a sort statement that will read in
server name
password
PUT 'aaaaaaaa.bbbbbbbb.ccc' filename.txt
quit

and output this

server name
password
PUT 'aaaaaaaa.bbbbbbbb.ccc' filename20040722.txt
quit


Thanks,

Ram
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Fri Jul 23, 2004 5:29 am    Post subject: Reply with quote

Ram,

The following JCL will give you the desired results. The parm / is used to write a new line. You can hardcode a value by enclosing by C'MY HARD CODED VALUE' which will be printed as
Code:

MY HARD CODED VALUE


since your servername and password are all constants you can hardcode them in the sort control cards itself. This will eliminate the IEBGENER step as well as 2 extra datasets

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT    DD SYSOUT=*                           
//SORTIN    DD *                                 
PUT 'AAAAAAAA.BBBBBBBB.CCC' FILENAME             
//SORTOUT DD DSN=xxx.yyy.zzz,(disp=shr)
//SYSIN     DD *                                 
  SORT FIELDS=COPY                                 
  OUTFIL OUTREC=(C'SERVER NAME',/,                 
                 C'PASSWORD',/,                   
                 1,36,DATE1,C'.TXT',/,             
                 C'QUIT',80:X)                     
/*                                               


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Wed Jul 28, 2004 5:21 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Jul 27, 2004 1:46 am    Post subject: Reply with quote

Kolusu,

Thanx a zillion Smile . I want to quote something that is really apt and suited for this site.

Knowledge is power, Knowledge shared is power multiplied. Bob Noyce.

Thanks once again Very Happy

Ram
Back to top
View user's profile Send private message
YSMVS
Beginner


Joined: 19 May 2004
Posts: 51
Topics: 25
Location: My House

PostPosted: Tue Jul 27, 2004 5:55 pm    Post subject: Reply with quote

Quote:

OUTREC FIELDS=(1,36,DATE1,C'.TXT',32X)


Koulsu,
I am just curious to know, why the above statement is needed again as it is present in the OUTFIL OUTREC statement.

I have got some other question also.
If I open the dataset which I create from this job in BROWSE mode I could not see the first character of every line. On the other hand if I open in the edit mode it shows properly. What could be the reason ?

thanks,
YSMVS.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Jul 27, 2004 11:28 pm    Post subject: Reply with quote

YSMVS,

What is the Record format of the SORTOUT / SORTIN you are using ? Is it FBA by any chance ? If so, then you will not be able to see the first column in browse mode since it treats the first col as the ANSI Carriage control char (used for page breaks & line breaks). Change the RECFM to FB. It should work.

If not, please post the JCL you are using. 'cas I could not see any problem in kolusu's solution.

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Wed Jul 28, 2004 5:23 am    Post subject: Reply with quote

ysmvs,

Quote:

Koulsu,
I am just curious to know, why the above statement is needed again as it is present in the OUTFIL OUTREC statement.


Sorry that was a typo. You don't really nead it. I edited the post now

And for your other query, see phantom's response.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group