Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us