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 Match two files using multiple keys a... santoshks1987 SYNCSORT 3 Fri Aug 18, 2017 10:50 am
No new posts Getting Mutiple input from Panels vidyaa CLIST & REXX 11 Mon Aug 14, 2017 1:28 pm
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm


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