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 take only the first three to the output file

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

New User


Joined: 02 Apr 2005
Posts: 4

PostPosted: Fri Feb 01, 2008 10:27 am    Post subject: Need to take only the first three to the output file
Reply with quote

Hi

Input FILE HAS RECORDS IN as below.

12345,abc,1278,ihu,pppsdd, etc...


I need to take only the first three to the output file.

i.e

12345,abc,1278

Field length is not fixed and the requirement is to have the first three fields only.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 11:12 am    Post subject:
Reply with quote

numr
You are confusing with the terms RECORD and FIELDS....
You havent told the attributes of i/p file - whether its FB or VB?
Quote:
Input FILE HAS RECORDS IN as below.

You said records, but what you have shown is only one record.

Quote:
I need to take only the first three to the output file.
"first three" fields or records?
Back to top
View user's profile Send private message
numr

New User


Joined: 02 Apr 2005
Posts: 4

PostPosted: Fri Feb 01, 2008 11:23 am    Post subject: Reply to: Need to take only the first three to the output fi
Reply with quote

Sorry for the confusion.


Input FILE HAS RECORDS as below.

12345,abc,1278,ihu,pppsdd,
erdfghh,123,tfsdhk,ws,qwerty,


I need to take only the first three fields in each record to the output file.
Field length is not constant.
i.e

12345,abc,1278
erdfghh,123,tfsdhk

Please help
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 Feb 01, 2008 10:09 pm    Post subject:
Reply with quote

I think you're saying you have CSV (comma separated value) records and you only want to keep the first three values in each record. Here's a DFSORT job that will do that. I assumed your input file has RECFM=FB and LRECL=80 and that each field can be a maximum of 20 characters, but you can change the job appropriately as needed.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
12345,abc,1278,ihu,pppsdd,
erdfghh,123,tfsdhk,ws,qwerty,
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=20),
               %02=(ENDBEFR=C',',FIXLEN=20),
               %03=(ENDBEFR=C',',FIXLEN=20)),
     OVERLAY=(1:%01,%02,%03,
      1:1,60,SQZ=(SHIFT=LEFT,MID=C','),80:X)
/*


For more information on DFSORT's PARSE and SQZ functions, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
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 Incorrect output when trying to add n... monica1 PL/I & Assembler 7 Fri Jan 13, 2017 5:02 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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