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
 

 

Cpoying field from input file to output at a fixed position.

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

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu Apr 05, 2007 11:12 pm    Post subject: Cpoying field from input file to output at a fixed position.
Reply with quote

I have an input flat file. It contains a field say var1 from position 1 onwards.
Eg.
123456789012(Columns)
nikhilluckisher
rajeshjk
prabhatjkljl

This is the only field in the file and varies in length from 7 to 11.

Now i want to copy it in an output file.
The format of this file is
123456789012345678901234567890123(Columns)
TRANSCACTION VAR1; DISPLAY:

The fields TRANSACTION and DISPLAY are fixed and appear in every record from the output field.

Now I want to copy the field var1 from input file into VAR1 field of output file. And also delimit it by ;(semi colon)

Eg.
TRANSCACTION nikhilluckishere; DISPLAY
TRANSCACTION rajeshjk; DISPLAY
TRANSCACTION prabhatjkljl; DISPLAY


I hope this is clear to you all.
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: Fri Apr 06, 2007 2:53 am    Post subject:
Reply with quote

Quote:
This is the only field in the file and varies in length from 7 to 11.


In your example, the maximum length is 15, not 11. Also, you spelled 'TRANSACTION" incorrectly.

At any rate, here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's SQZ function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD *                                                       
nikhilluckisher                                                     
rajeshjk                                                           
prabhatjkljl           
/*                                             
//SORTOUT DD SYSOUT=*                                               
//SYSIN    DD    *                                                 
  OPTION COPY         
  INREC IFTHEN=(WHEN=INIT,                             
    BUILD=(C'TRANSACTION',                             
       13:1,15,SQZ=(SHIFT=LEFT,TRAIL=C';',LENGTH=16), 
       C' DISPLAY')),                                 
   IFTHEN=(WHEN=INIT,                                 
    OVERLAY=(13:13,24,SQZ=(SHIFT=LEFT,MID=C' ')))     
/*


SORTOUT will have:

Code:

TRANSACTION nikhilluckisher; DISPLAY     
TRANSACTION rajeshjk; DISPLAY           
TRANSACTION prabhatjkljl; DISPLAY       
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: Fri Apr 06, 2007 8:46 pm    Post subject:
Reply with quote

Here's a simpler DFSORT job to do the same thing:

Code:

//S1    EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD *                                                       
nikhilluckisher                                                     
rajeshjk                                                           
prabhatjkljl           
/*                                             
//SORTOUT DD SYSOUT=*                                               
//SYSIN    DD    *                                                 
  OPTION COPY         
  INREC BUILD=(1,15,SQZ=(SHIFT=LEFT,LEAD=C'TRANSACTION ',
    TRAIL=C'; DISPLAY',LENGTH=36))                       
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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