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
 
How to extract a field from a VB file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: How to extract a field from a VB file
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: 1532
Location: Chennai

PostPosted: Mon Dec 22, 2014 5:37 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Dec 22, 2014 6:15 pm    Post subject: Reply to: How to extract a field from a VB file
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Dec 22, 2014 8:08 pm    Post subject: Reply to: How to extract a field from a VB file
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Dec 22, 2014 8:46 pm    Post subject: Reply to: How to extract a field from a VB file
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

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