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
 

 

prefixing characters using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nimisanand

New User


Joined: 22 Nov 2005
Posts: 23

PostPosted: Mon May 16, 2011 9:05 pm    Post subject: prefixing characters using sort
Reply with quote

Hi,

I have a input file which has FTP information

FTP (EXIT
IP Address
Userid
password
pwd
ascii
cd <path where you need to put the file>
pwd
PUT '<host file name>' 1233_20110514_064239_files.dat
QUIT

The host file name always starts with 1233. I would like to prefix ab_c_ to this file.

File length is 80.

The o/p file should have the following result

FTP (EXIT
IP Address
Userid
password
pwd
ascii
cd <path where you need to put the file>
pwd
PUT '<host file name>' ab_c_1233_20110514_064239_files.dat
QUIT


Could you please let me know if this can be done using SORT.
Back to top
View user's profile Send private message

rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Mon May 16, 2011 9:55 pm    Post subject: Reply to: prefixing characters using sort
Reply with quote

Try this

Code:
//SYSIN    DD *                                                         
 SORT FIELDS=COPY                                                       
 OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'PUT'),BUILD=(1,23,24:C'AB_C_',24,30))
/*                                                                     
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon May 16, 2011 9:55 pm    Post subject:
Reply with quote

nimisanand,

The following DFSORT/JCL will give you the desired results. make sure you have enough space to prefix or else your data will get truncated.

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
FTP (EXIT                                               
IP ADDRESS                                             
USERID                                                 
PASSWORD                                               
PWD                                                     
ASCII                                                   
CD <PATH WHERE YOU NEED TO PUT THE FILE>               
PWD                                                     
PUT '<HOST FILE NAME>' 1233_20110514_064239_FILES.DAT   
QUIT                                                   
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'PUT'),               
  FINDREP=(INOUT=(C'1233',C'AB_C_1233'),OVERRUN=TRUNC))
//*
Back to top
View user's profile Send private message
nimisanand

New User


Joined: 22 Nov 2005
Posts: 23

PostPosted: Mon May 16, 2011 11:48 pm    Post subject:
Reply with quote

Thank you..

FINDREP worked for me
Back to top
View user's profile Send private message
Pinchoo

New User


Joined: 22 Nov 2005
Posts: 8
Location: hyderabad

PostPosted: Thu May 19, 2011 11:18 am    Post subject:
Reply with quote

I have also kind of similar requirement but instead of a hard coded name i have to pick the name from the file itself

FTP (EXIT
IP Address
Userid Trans
password
pwd
ascii
cd <path where you need to put the file>
pwd
PUT '<host file name>' Trans_20110514_064239_files.dat
QUIT

FTP (EXIT
IP Address
Userid COMM
password
pwd
ascii
cd <path where you need to put the file>
pwd
PUT '<host file name>' Comm_20110514_064239_files.dat
QUIT
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Thu May 19, 2011 3:00 pm    Post subject:
Reply with quote

Are those 2 different sets of FTP control cards or 1. If 2 you can preprocess the data to extract the userid and create a symname which can then be passed to the second step.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu May 19, 2011 9:22 pm    Post subject:
Reply with quote

Pinchoo,
I am assuming you are trying to replace user-id on PUT line with that of USERID(defined on line3). I am also assuming 80 byte input and 80 byte output with 7 byte TSO ID.

See if below jcl works.
Code:

//STEP001  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
FTP (EXIT                                                               
IP ADDRESS                                                             
USERID XXXYYYY          --> Pick this User ID                                         
PASSWORD                                                               
PWD                                                                     
ASCII                                                                   
CD <PATH WHERE YOU NEED TO PUT THE FILE>                               
PWD                                                                     
PUT '<HOST FILE NAME>' AAABBBB_20110514_064239_FILES.DAT     --> Replace on this line
QUIT                                                                   
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN DD *                                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'USERID'),PUSH=(81:8,8)), 
        IFTHEN=(WHEN=(1,3,CH,EQ,C'PUT'),OVERLAY=(24:81,8))             
  SORT FIELDS=COPY                                                     
  OUTFIL BUILD=(1,80)                                                   
/*                                                                     


OUTPUT
Code:
FTP (EXIT                                                     
IP ADDRESS                                                   
USERID XXXYYYY                                               
PASSWORD                                                     
PWD                                                           
ASCII                                                         
CD <PATH WHERE YOU NEED TO PUT THE FILE>                     
PWD                                                           
PUT '<HOST FILE NAME>' XXXYYYY 20110514_064239_FILES.DAT     
QUIT                                                         


Thanks,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 19, 2011 9:39 pm    Post subject:
Reply with quote

sqlcode1,

With a space on the put statement you are generating an invalid control card.

Pinchoo,

Show us the INPUT and desired output with examples.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu May 19, 2011 9:55 pm    Post subject:
Reply with quote

Kolusu,
I assumed 7 byte id but accounted for 8 bytes. Apologize for the incorrect solution posted earlier

Pinchoo,
Below is the corrected card. See if this works for you.
Code:
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'USERID'),PUSH=(81:8,7)),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'PUT'),OVERLAY=(24:81,7))             
  SORT FIELDS=COPY                                                     
  OUTFIL BUILD=(1,80)                                                 

OUTPUT
Code:
FTP (EXIT                                               
IP ADDRESS                                             
USERID XXXYYYY                                         
PASSWORD                                               
PWD                                                     
ASCII                                                   
CD <PATH WHERE YOU NEED TO PUT THE FILE>               
PWD                                                     
PUT '<HOST FILE NAME>' XXXYYYY_20110514_064239_FILES.DAT
QUIT                                                   


Thanks,
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri May 20, 2011 2:20 am    Post subject: Reply to: prefixing characters using sort
Reply with quote

Still its the same thing. The value of user-id is different in both the cases.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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