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
 

 

Need to apend a character in each record

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

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Wed Mar 04, 2009 10:48 am    Post subject: Need to apend a character in each record
Reply with quote

Hi,

I need to apend two characters in each record of the input file.

Let the Input file is of lrecl = 80 and FB.
Code:

----+----1----+----2----+----3----+----4----+----
Header;sdsad;dasda;sdaasd
001;1254;lklk;12222
121554;15454;dfgdg


So the O/p Should be like below,
Code:

----+----1----+----2----+----3----+----4----+----
Z;Header;sdsad;dasda;sdaasd
X;001;1254;lklk;12222
X;121554;15454;dfgdg



The condition may be of these two,
1) Apend the letter "Z;"in the first row and "X;" in the next of the rows.
2) If the first letter is character then apend with Z; or if numeric then with X;

Thanks in advance.
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 992
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Mar 04, 2009 1:25 pm    Post subject:
Reply with quote

Quote:
I need to apend two characters in each record of the input file.


From your example, you want to prepend the 2 characters. Here's a job that should do that for you.

Code:
//STEP01   EXEC PGM=ICEMAN  (OR DFSORT)           
//SYSPRINT DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                   
Header;sdsad;dasda;sdaasd                         
001;1254;lklk;12222                               
121554;15454;dfgdg                                 
//*                                               
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *                                       
* -------------------------------------------------
 OPTION COPY                                       
* ------------------------------------------------
 INREC OVERLAY=(81:SEQNUM,8,ZD)                   
 OUTREC IFTHEN=(WHEN=(81,8,ZD,EQ,1),               
           BUILD=(C'Z;',1,80)),                   
        IFTHEN=(WHEN=NONE,                         
           BUILD=(C'X;',1,80))                     
/*                                                 


Garry.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 04, 2009 11:01 pm    Post subject:
Reply with quote

Niki,

Here's a DFSORT job that will do what you want based on this rule:

Quote:

2) If the first letter is character then apend with Z; or if numeric then with X;


Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/82)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,FS,EQ,NUM),BUILD=(C'X:',1,80)),
        IFTHEN=(WHEN=NONE,BUILD=(C'Z:',1,80))
/*
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Thu Mar 05, 2009 11:04 am    Post subject: Reply to: Need to apend a character in each record
Reply with quote

Hi Garry / Frank,

Thanks for the help.

I just changed as per my specification and got the output.
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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