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
 

 

JCL for FTP - Is it possible to get current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
zahari

New User


Joined: 25 Nov 2005
Posts: 5
Location: M'sia

PostPosted: Fri Nov 25, 2005 5:09 pm    Post subject: JCL for FTP - Is it possible to get current date
Reply with quote

Code:

//SYSPFTP  JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,
//         REGION=3072K                                 
//*                                                     
// SET DATE=1125                                         
//*                                                     
//FTP      EXEC PGM=FTP                                 
//OUTPUT   DD SYSOUT=*                                   
//SYSIN    DD *                                         
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR        *my user id and password           
// DD *                                                 
LCD JCLLIB                                               
CD ABC                                                   
CD ABB                                                   
PUT TEST TEST.D&DATE                                     
QUIT                                                     
/*               


My jcl above is to ftp (put/get) from mainframe to server.
1- I can get connected but the date variable did not follow variable set.
2- And is it possible for the date to get the current date.
:!:
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Sun Nov 27, 2005 4:33 am    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Try this method instead:

Code:

//SYSPFTP  JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,
//         REGION=3072K                                 
//*                                                     
// SET DATE=1125                                         
//*                                                     
//FTP      EXEC PGM=FTP                                 
//OUTPUT   DD SYSOUT=*           
//SYSUT1   DD DSN=TEST.D&DATE,DISP=SHR
//SYSIN    DD *                                         
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR        *my user id and password           
// DD *                                                 
LCD JCLLIB                                               
CD ABC                                                   
CD ABB                                                   
PUT //DD:SYSUT1
QUIT                                                     
/*               
Back to top
View user's profile Send private message
zahari

New User


Joined: 25 Nov 2005
Posts: 5
Location: M'sia

PostPosted: Mon Nov 28, 2005 7:24 am    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Thanks Superk for your reply. I try it this way:

//SYSPFTP JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,
// REGION=3072K
//*
// SET DATE=1128
// SET WIN=A
//*
//FTP EXEC PGM=FTP
//OUTPUT DD SYSOUT=*
//SYSUT1 DD DSN=D&DATE,DISP=SHR
//SYSUT2 DD DSN=MNC&DATE&WIN..TXT,DISP=SHR
//SYSIN DD *
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR
// DD *
PROMPT
LCD JCLLIB
CD MEPS
CD ABB
PUT //DD:SYSUT1
GET //DD:SYSUT2
QUIT
/*

But the JCL give me this error:

SYSPFTP FTP SYSUT1 - DATA SET NOT FOUND
SYSPFTP FTP - STEP WAS NOT EXECUTED.

Can you/anyone tell me what is wrong with my JCL.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Nov 28, 2005 2:32 pm    Post subject: JCL
Reply with quote

Hi frnd,


Plz check out this code

Code:
//SYSIN DD *
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR
// DD *
PROMPT
LCD JCLLIB
CD MEPS
CD ABB
PUT //DD:SYSUT1
GET //DD:SYSUT2
QUIT
/*


i think the error is in this above structure only.

y can't it be replaced in this way

Code:
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR
//SYSIN DD *
PROMPT
LCD JCLLIB
CD MEPS
CD ABB
PUT //DD:SYSUT1
GET //DD:SYSUT2
QUIT
/*



check out and let me know.
Back to top
View user's profile Send private message
zahari

New User


Joined: 25 Nov 2005
Posts: 5
Location: M'sia

PostPosted: Mon Nov 28, 2005 3:29 pm    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Hi Kamarutheen,

Thanks for the reply. But my below JCL still have some error.

//SYSPFTP JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,
// REGION=3072K
//*
// SET DATE=1128
// SET WIN=A
//*
//FTP EXEC PGM=FTP,PARM='(EXIT'
//OUTPUT DD SYSOUT=*
//SYSUT1 DD DSN=SYSP002.TEST.MNC&DATE&WIN,DISP=SHR
//SYSIN DD *
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR *IP & USER ID/PASSWD
// DD *
PROMPT OFF
LCD JCLLIB
CD MEPS
CD ABB
PUT //DD:SYSUT1
QUIT
/*

My above JCL give me this error:
EZA1736I PUT //DD:SYSUT1
EZA1685W Invalid local file identifier
EZA1735I FTP Return Code = 27000

It seems that the SYSUT1 DSN was not understood by the FTP JCL.
Help me anybody!
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Nov 28, 2005 4:59 pm    Post subject: JCL- FTP
Reply with quote

hi frnd,
u r using this code na...
Quote:
PUT //DD:SYSUT1


so once put is used as like that v need to specify the destination file na.. i think that may be the error.

use like this
Quote:
PUT //DD:SYSUT1 'some PDS name'


.. let me know if any problem.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Mon Nov 28, 2005 7:18 pm    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

zahari, my apologies, but it appears I may have been misleading you. A quick test showed that FTP does not substitute the dataset name as the target dataset when using the PUT command as I originally showed.

khamarutheen is correct in stating that you will have to supply the target filename. It looks like you will have to write the code, or use a standard utility program, to generate the required PUT statement with an appropriate date value.

An easy solution using REXX would be:
Code:

//SYSPFTP  JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,
//         REGION=3072K                                 
//*                                                     
// SET DATE=1125                                         
//*
//GENER    EXEC PGM=IEBGENER                         
//SYSUT1   DD   *,DLM=@@                             
/* REXX */                                           
PARSE ARG                                             
QUEUE "PUT TEST TEST.D"ARG(1)                         
QUEUE ""                                             
"EXECIO * DISKW FTPCNTL (FINIS"                       
@@                                                   
//SYSUT2   DD   DSN=&&PDS(X),DISP=(,PASS),UNIT=VIO,   
//         SPACE=(TRK,(1,1,1))                       
//SYSPRINT DD   SYSOUT=*                             
//SYSIN    DD   DUMMY                                 
//*                                                     
//TSO      EXEC PGM=IKJEFT01,PARM='X &DATE'             
//SYSPROC  DD   DSN=&&PDS,DISP=(OLD,PASS)               
//SYSTSPRT DD   SYSOUT=*                                 
//SYSTSIN  DD   DUMMY                                   
//FTPCNTL  DD   DSN=&&CNTL,DISP=(,PASS),UNIT=VIO,       
//         SPACE=(TRK,(1,1))                             
//*                                                     
//FTP      EXEC PGM=FTP                                 
//OUTPUT   DD SYSOUT=*                                   
//SYSIN    DD *                                         
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR        *my user id and password           
// DD *                                                 
LCD JCLLIB                                               
CD ABC                                                   
CD ABB                                                   
//         DD   DSN=&&CNTL,DISP=(OLD,PASS)
// DD *
QUIT                                                     
/*   
Back to top
View user's profile Send private message
zahari

New User


Joined: 25 Nov 2005
Posts: 5
Location: M'sia

PostPosted: Tue Nov 29, 2005 2:25 pm    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Thank you very much Superk.

The REXX JCL works as my requirement.
Need another help on how to shorten the JCL since we have many FI (more 25). If I put all FI (cd FI1, cd FI2 ... and then the GET/PUT command) it going to be lenghty (see below JCL).
Code:

//SYSPFTP  JOB 090000,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,   
//         REGION=3072K                                   
//*                                                       
// SET DATE=1128                                     
//GENER    EXEC PGM=IEBGENER                               
//SYSUT1   DD   *,DLM=@@                                   
/* REXX */                                                 
PARSE ARG                                                 
QUEUE "CD FI1"                        * I have alots of FI* (>25) here
QUEUE "GET MNC"ARG(1)A.TXT "'SYSP002.TEST.MNCABB' (REPLACE"         
QUEUE "GET MRT"ARG(1)A.TXT "'SYSP002.TEST.MRTABB' (REPLACE"
QUEUE "CD ../FI2"                                         
QUEUE "GET MNC"ARG(1)A.TXT "'SYSP002.TEST.MNCMBB' (REPLACE"
QUEUE "GET MRT"ARG(1)A.TXT "'SYSP002.TEST.MRTMBB' (REPLACE"
QUEUE "CD ../FI3"                                         
QUEUE "GET MNC"ARG(1)A.TXT "'SYSP002.TEST.MNCSBB' (REPLACE"
QUEUE "GET MRT"ARG(1)A.TXT "'SYSP002.TEST.MRTSBB' (REPLACE"
QUEUE "CD ../FI1"                                         
QUEUE "PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
QUEUE "CD ../FI2"                                         
QUEUE "PUT 'SYSP002.TEST.MNCMBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCMBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCMBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCMBB' MRT"ARG(1)A.TXT
QUEUE "CD ../FI3"                                         
QUEUE "PUT 'SYSP002.TEST.MNCSBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCSBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCSBB' MRT"ARG(1)A.TXT
QUEUE "PUT 'SYSP002.TEST.MNCSBB' MRT"ARG(1)A.TXT
QUEUE ""                                                   
"EXECIO * DISKW FTPCNTL (FINIS"                           
@@                                                         
//SYSUT2   DD   DSN=&&PDS(X),DISP=(,PASS),UNIT=DISK,       
//         SPACE=(TRK,(1,1,1))                             
//SYSPRINT DD   SYSOUT=*             
//SYSIN    DD   DUMMY                             
//*                                               
//TSO      EXEC PGM=IKJEFT01,PARM='X &DATE'       
//SYSPROC  DD   DSN=&&PDS,DISP=(OLD,PASS)         
//SYSTSPRT DD   SYSOUT=*                         
//SYSTSIN  DD   DUMMY                             
//FTPCNTL  DD   DSN=&&CNTL,DISP=(,PASS),UNIT=DISK,
//         SPACE=(TRK,(1,1))                     
//*                                               
//FTP      EXEC PGM=FTP                           
//OUTPUT   DD SYSOUT=*                           
//SYSIN    DD *                                   
// DD DSN=SYSP002.JCLLIB(INFO),DISP=SHR     * ip,userid & passwd
// DD *                                           
LCD JCLLIB                                       
CD ABC                                         
SENDSITE                                         
//         DD   DSN=&&CNTL,DISP=(OLD,PASS)       
// DD *                     
QUIT                                                                                     


Help me Superk/anyone because I'm not really good with REXX.

Also thanks to khamarutheen for your input.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Nov 29, 2005 9:34 pm    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

zahari wrote:
Help me Superk/anyone because I'm not really good with REXX.

Then why not use a language/utility that you ARE familiar with? The process is the same:

  • Get the date value from the PARM
    <or>
    use the current system date.
  • Build the FTP GET or PUT records.
  • Write the records to an output DD.
  • Use those GET/PUT records in the FTP step.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Nov 29, 2005 9:54 pm    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Code:

PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT

Why 4 PUT's of the same dataset to the same filename?
Back to top
View user's profile Send private message
zahari

New User


Joined: 25 Nov 2005
Posts: 5
Location: M'sia

PostPosted: Wed Nov 30, 2005 6:48 am    Post subject: Re: JCL for FTP - Is it possible to get current date
Reply with quote

Thanks Superk.

Then why not use a language/utility that you ARE familiar with? The process is the same:
- Get the date value from the PARM <or>
- Use the current system date.
- Build the FTP GET or PUT records.
- Write the records to an output DD.
- Use those GET/PUT records in the FTP step.

I'm new with this JCL and REXX. My expertise is more to Windows application area. I have a VB program doing the Job all the while, but the management has decided to run the Job from the mainframe instead of Server for a security reason. So here I am, struggling with this new line.
I hope you can understand.

And for :

PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT
PUT 'SYSP002.TEST.MNCABB' MRT"ARG(1)A.TXT

You are right the put should put different dataset to a different files. I have copied the wrong line. Sorry. Anyway this is what I try to achive:

For each FI1..F2.. F3...n
PUT 'SYSP002.TEST.PRDABB' DIST"ARG(1)A.TXT
PUT 'SYSP002.TEST.PEDABB' DISTREC"ARG(1)A.TXT
PUT 'SYSP002.TEST.PRCABB' COLL"ARG(1)A.TXT
PUT 'SYSP002.TEST.PECABB' COLLREC"ARG(1)A.TXT

Sorry again if I confuse everyone.
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


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