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 

need help to modify file name destination in ftp

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
jalves
Beginner


Joined: 27 Nov 2006
Posts: 4
Topics: 1
Location: Lisboa

PostPosted: Tue Nov 28, 2006 8:24 am    Post subject: need help to modify file name destination in ftp Reply with quote

Hi,

i'm a beginner in JCL but i have a huge problem to solv.
I need to export files from IBM to Unix to load a datawharehouse. Currently i use a step like this:
//**********************************************************************
//* FTP DO FICHEIRO GFTPAGA0 *
//**********************************************************************
//FTPGPS1 EXEC PGM=FTP,REGION=4096K,COND=(4,LT)
//*STEPLIB DD DSN=TCPIP.SEZALINK,DISP=SHR
//SYSTCPD DD DSN=TCPIPP.CONFIG(TCPDATAP),DISP=SHR
//SYSFTPD DD DSN=TCPIPP.CONFIG(FTPDATAP),DISP=SHR
//INPUT DD *
1.2.3.4
xpto
otpx
cd mydir
PUT 'PSIG.DW.SPTCACT0.DWHOUSE.TEMP' SPTCACT.dat
close
end
//OUTFILE DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
/*


What i would like to do is change the file name of the destination file by adding a numeric value stored
in a DB2 table or in a dataset. This value would be increased and updated each time the job run.
In the previous job that would be replacing de "SPTCACT.dat" name with "SPTCACT001.dat" at runtime.
After next execution the output would be "SPTCACT002.dat" and son on.
Can any one help me ?
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Nov 28, 2006 10:45 am    Post subject: Reply with quote

Well, I don't know DB2, so can't help you there. Certainly, a process to read, increment, and store a sequence counter is a trivial exercise.

Have you consider using the FTP "StoreUnique (SU)" option? If your FTP server site supports it, maybe it would be easier to implement.

Here's a link to a description of the SUnique option.
Back to top
View user's profile Send private message
jalves
Beginner


Joined: 27 Nov 2006
Posts: 4
Topics: 1
Location: Lisboa

PostPosted: Tue Nov 28, 2006 1:28 pm    Post subject: Reply with quote

I have tried the FTP with "StoreUnique (SU)" option. It does not solv my problem because, after loading
the data into the warehouse, i move the file from the destination directory to a backup directory. The SU
option needs to find the same file name in the remote server directory.
Besides i need all the file names to be unique since the first extraction.
Thanks, anyway!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Nov 28, 2006 1:34 pm    Post subject: Reply with quote

jalves,

You can use EZACFM1 to create a dynamic file names. Check these links

http://mvsforums.com/helpboards/viewtopic.php?t=4664&highlight=ezacfsm1

http://mvsforums.com/helpboards/viewtopic.php?t=2353&highlight=ezacfsm1

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jalves
Beginner


Joined: 27 Nov 2006
Posts: 4
Topics: 1
Location: Lisboa

PostPosted: Thu Nov 30, 2006 8:15 am    Post subject: Reply with quote

kolusu,

thanks for your advice. But it did not solv my problem completely.
Based on the information provided by the links i created the following job.
Code:

//DSVUSER  JOB ,'TEST    ',MSGCLASS=X,CLASS=D,NOTIFY=DSVUSER,REGION=4M
//*
//BUILDSEQ EXEC PGM=EZACFSM1
//SYSPRINT DD SYSOUT=*
//SYSOUT DD DSN=&SEQ,DISP=(NEW,PASS),
//          UNIT=SYSDA,
//          SPACE=(CYL,(5,1),RLSE)
//SYSIN DD *
SELECT COUNTER_NUM FROM MYTABLE;
//*
//BUILDCMD EXEC PGM=EZACFSM1
//SYSPRINT DD SYSOUT=*
//SYSOUT DD DSN=&CMD,DISP=(NEW,PASS),
//          UNIT=SYSDA,
//          SPACE=(CYL,(5,1),RLSE)
//SYSIN DD *
*IP*
*USER*
*PWD*
PUT 'FILE' FILE.&LYR4&LMON&SEQ..TXT
QUIT
//*
//FTPSTEP  EXEC PGM=FTP,REGION=4096K,COND=(4,LT)
//SYSTCPD  DD DSN=TCPIP.CONFIG(TCPDATAP),DISP=SHR
//SYSFTPD  DD DSN=TCPIP.CONFIG(FTPDATAP),DISP=SHR
//SYSPRINT DD SYSOUT=*
//INPUT DD DSN=&CMD,DISP=(OLD,DELETE)
//OUTPUT DD SYSOUT=*
//*


The resulting output is "FILE.200611&SEQ..TXT" and i would like it to be "FILE.200611001.TXT".
The 0001 is the value stored in COUNTER_NUM field of my table.
It is not possible to pass a value from a variable to another variable through steps ?

Thanks in advance.
I could really use some help.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Nov 30, 2006 9:19 pm    Post subject: Reply with quote

jalves,

there is no symbolic to increase the seq number. You need to store the file as unique. so I suggested to use the date , time as part of the filename so that they are unique

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jalves
Beginner


Joined: 27 Nov 2006
Posts: 4
Topics: 1
Location: Lisboa

PostPosted: Fri Dec 01, 2006 5:23 am    Post subject: Reply with quote

kolusu,

i'm not concerned about increasing the seq number any more. I can do that with a select statement or a REXX program.
What i'm asking, to you or anyone, is some help to find out why the output of the previous job does not use the
value stored in SEQ variable inside the CMD variable, or if there is another way to do it.
I understand you must have better things to do but allow me to tell you the all story.
Each time our datawarehouse extraction process executes, the unix server receives data files with the newest
information stored in the online database. Due to several problems sometimes we must execute the DW loading
processes manually. Thats when, once in a while, the order of the files is confused and our DW database
becomes inaccurate. To solve this we intend to change our programs in order to keep track of the next file number
to be loaded. Programs will not process file 3 if they are expecting file 2. Thats why we can't use date and time in
file names. Our programs need to know the name of the correct datafile to be loaded next.
Any ideas ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Dec 01, 2006 11:38 am    Post subject: Reply with quote

jalves,

Here is an idea. This will increase the seqnum everytime it ran.

Create a 80 byte FB recfm format. It will have just 2 lines to begin with.
Populate the above defined file with this

let us say this filename is userid.ftp.seq
Code:

BUMPNUM,C'001'
FILENUM,C'001'


Now run this job.

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SYMNAMES DD DSN=userid.ftp.seq,           
//            DISP=SHR                       
//SORTIN   DD DSN=userid.ftp.seq,           
//            DISP=SHR                       
//FILECNT  DD DSN=userid.ftp.seq,           
//            DISP=SHR                       
//FTPCARD  DD DSN=USERID.FTP.PARMS,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                               
 SORT FIELDS=COPY                             
 OUTFIL FNAMES=FILECNT,REMOVECC,NODETAIL,     
 TRAILER1=(C'BUMPNUM,C',                     
          '''',                               
          C'001',                             
          '''',/,                             
          C'FILENUM,C',                       
          '''',                               
          TOT=(11,3,ZD,EDIT=(TTT)),           
          '''',80:X)                         
 OUTFIL FNAMES=FTPCARD,REMOVECC,NODETAIL,     
 TRAILER1=(C'1.2.3.4',/,                     
           C'XPTO',/,                         
           C'OTPX',/,                         
           C'CD MY DIR',/,                   
           C'PUT',                           
           '''',                             
           C'PSIG.DW.SPTCACT0.DWHOUSE.TEMP', 
           C' SPTCACT',FILENUM,               
           C'.DAT',/,                         
           C'CLOSE',/,                       
           C'END',80:X)                       
/*                                           


After every run you will see the filenum being incremented.

Now you will use this dynamically created userid.ftp.parms dsn as sysin to ftp step.

Code:

//**********************************************************
//* FTP DO FICHEIRO GFTPAGA0 *
//**********************************************************
//FTPGPS1 EXEC PGM=FTP,REGION=4096K,COND=(4,LT)
//*STEPLIB DD DSN=TCPIP.SEZALINK,DISP=SHR
//SYSTCPD DD DSN=TCPIPP.CONFIG(TCPDATAP),DISP=SHR
//SYSFTPD DD DSN=TCPIPP.CONFIG(FTPDATAP),DISP=SHR
//INPUT   DD DSN=USERID.FTP.PARMS,DISP=SHR


Hope this helps...

Cheers

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 -> Job Control Language(JCL) 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