IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Fri Apr 06, 2007 2:53 am
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:

Use [URL] BBCode for External Links

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 Developer


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

PostPosted: Fri Apr 06, 2007 8:46 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top