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

How to extract a field from a VB file


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 4:53 pm
Reply with quote

Hi,

I have a VB file of length 446 bytes (input file).

I need to extract a field SSN that is 9 bytes long and can occur anywhere from 40th byte onward to 110th byte onward in the file.

The SSN has to be extracted to an output file of length 9 bytes.

How can this be achieved using SORT.

Regards.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1689
Location: Tiruppur, India

PostPosted: Mon Dec 22, 2014 5:37 pm
Reply with quote

Hello,
Show us how the input file will look like and the expected output.
Someone would be able to help you with that.
Back to top
View user's profile Send private message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 5:46 pm
Reply with quote

input file sample records

Code:


500400¦SQLLDR¦11-OCT-99¦SQLLDR¦11-OCT-99¦¦JKLMN¦M¦ABCDE¦¦¦¦13-JUN-40¦¦0¦¦¦¦7¦¦405541010¦¦KY¦¦¦¦¦
500401¦SQLLDR¦11-OCT-99¦AGL R=1203579¦15-FEB-02¦¦JKLMNO DIX¦¦ACDEF¦¦¦¦¦¦2¦¦¦¦7¦¦000000000¦¦MD¦¦¦¦¦
500402¦SQLLDR¦11-OCT-99¦SQLLDR¦11-OCT-99¦¦LMNOPQR¦S¦AEFGH¦¦¦¦04-MAR-46¦¦0¦¦¦¦7¦¦403627037¦¦KY¦¦¦¦¦
500403¦SQLLDR¦11-OCT-99¦BPSI404¦01-DEC-03¦¦STUVWX¦¦AGHIJ¦¦0¦0¦¦¦2¦0¦¦AHIJK¦7¦¦449683440¦¦CA¦¦¦¦¦


output file

Code:


405541010
000000000
403627037
449683440
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Dec 22, 2014 6:15 pm
Reply with quote

Looks like your data is "pipe-delimited" and you want the data after the 19th pipe?

You're going to need PARSE. Either with 18 dummy PARSE fields first, or you could FINDREP wth DO=18 to change the first 18 pipes to something else, then PARSE for the value you want.
Back to top
View user's profile Send private message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 6:21 pm
Reply with quote

Yes Bill, the data is pipe-delimited and I need the SSN that occurs after the 20th pipe.
Back to top
View user's profile Send private message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 7:48 pm
Reply with quote

Code:

//SYSIN    DD  *                             
  SORT FIELDS=COPY                           
  INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=15),
               %01=(ENDBEFR=C'|',FIXLEN=30),
               %02=(ENDBEFR=C'|',FIXLEN=08),
               %03=(ENDBEFR=C'|',FIXLEN=30),
               %04=(ENDBEFR=C'|',FIXLEN=08),
               %05=(ENDBEFR=C'|',FIXLEN=15),
               %06=(ENDBEFR=C'|',FIXLEN=30),
               %07=(ENDBEFR=C'|',FIXLEN=30),
               %08=(ENDBEFR=C'|',FIXLEN=45),
               %09=(ENDBEFR=C'|',FIXLEN=30),
               %10=(ENDBEFR=C'|',FIXLEN=15),
               %11=(ENDBEFR=C'|',FIXLEN=15),
               %12=(ENDBEFR=C'|',FIXLEN=08),
               %13=(ENDBEFR=C'|',FIXLEN=100),
               %14=(ENDBEFR=C'|',FIXLEN=01),
               %15=(ENDBEFR=C'|',FIXLEN=17),
               %16=(ENDBEFR=C'|',FIXLEN=15),
               %17=(ENDBEFR=C'|',FIXLEN=50),
               %18=(ENDBEFR=C'|',FIXLEN=15),
               %19=(ENDBEFR=C'|',FIXLEN=02),
               %20=(ENDBEFR=C'|',FIXLEN=20),
               %21=(ENDBEFR=C'|',FIXLEN=40),
               %22=(ENDBEFR=C'|',FIXLEN=02),
               %23=(ENDBEFR=C'|',FIXLEN=02),
               %24=(ENDBEFR=C'|',FIXLEN=15),
               %25=(ENDBEFR=C'|',FIXLEN=15),
               %26=(ENDBEFR=C'|',FIXLEN=20),
               %27=(ENDBEFR=C'|',FIXLEN=08)),
  BUILD=(%00,%20)                           
/*                                           


As per the suggestions received I'm using the above code for PARSING but I get an error stating:

Code:

WER276B  SYSDIAG= 26020, 642272, 642272, 2255850                 
WER164B  8,876K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 1,004K BYTES USED         
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                   
WER108I  SORTIN   : RECFM=VB   ; LRECL=   400; BLKSIZE= 27998     
WER073I  SORTIN   : DSNAME=PSHAREH.OL9.TDRUN.SQ.CSTUPRX2.DASD     
WER235A  INREC    RDW NOT INCLUDED                               
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     


Please advise where do I need to ADD the 4 bytes to take into account the VB.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Dec 22, 2014 8:08 pm
Reply with quote

First thing in your BUILD. (1,4,.....).
Back to top
View user's profile Send private message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 8:15 pm
Reply with quote

Thanks Bill. It worked. Appreciate your help. icon_biggrin.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Dec 22, 2014 8:46 pm
Reply with quote

Code:
//SYSIN    DD  *                             
  SORT FIELDS=COPY                           
  INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=15),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %=(ENDBEFR=C'|'),
               %20=(ENDBEFR=C'|',FIXLEN=20)),
  BUILD=(1,4,%00,%20)                           
/*                                           


Since you are not extracting data for most of your delimited columns, just skip over them with a %. Only "name" the onse you need.
Back to top
View user's profile Send private message
mohammad amir ashraff

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Mon Dec 22, 2014 8:50 pm
Reply with quote

Cool, thanks for the tip, will implement it.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
This topic is locked: you cannot edit posts or make replies. Write Character to Hexadecimal file w... COBOL Programming 8
No new posts Checking the total counts inside a re... JCL & VSAM 5
No new posts File-aid batch how to repeat a line... Compuware & Other Tools 2
Search our Forums:

Back to Top