Retrieving records dynamically from dynamic position



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Retrieving records dynamically from dynamic position

Postby ibmmf4u » Wed Oct 05, 2016 1:16 am

Hi,

I would like to retrieve records that contains a specified keyword that will be found any where in the record. I would like to retrieve the only the part of the record that starts after it encounters the keyword till the position where it encounters first encounters a colon .

Below are the details of the file. RECFM =FB , LRECL=1000.

Input file:-


12345678901234...ABC:345RSS567890...:XYZ:7634843..:DEF:893795...
01234567...ABC:763AUD64748909...:PQR:79395:GEF:789387593...
1234567890123456789234...ABC:345CAD567890...:XYZ:763..:MNO:893795...
212345679638645...ABC:763YEN6474890945456665...:BED:793956893...:JKL:7893...
 


The keyword specified here is "ABC:" and it can start any where in the record. I would like to extract only the part of record that has tag "ABC:" i.e. starting after we encounter the keyword "ABC:" till the time where it encounters the first colon ":" as shown below.

Output file:-

The entire ABC tag.


345RSS567890...
763AUD64748909...
345CAD567890...
763YEN6474890945456665...


I tried exploring the other ways but couldn't progress mush as i'm unaware of how we can get only the specific part of the record dynamically.

Below was the piece of code i just started and couldn't progress much.


SORT FIELDS=COPY
INCLUDE COND=(1,1000,SS,EQ,C"ABC:")
 



Can someone please help me in getting it resolved?

Thanks in advance :D
ibmmf4u
 
Posts: 65
Joined: Wed Dec 14, 2011 10:26 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Retrieving records dynamically from dynamic position

 

Re: Retrieving records dynamically from dynamic position

Postby Robert Sample » Wed Oct 05, 2016 1:58 am

I would like to retrieve the only the part of the record that starts after it encounters the keyword till the position where it encounters first encounters a colon .
You do not understand what a record is, do you? Either that or you are not saying what you want very well. You can only "retrieve" (by which I assume you mean read) an entire record -- from first byte to last byte. You may OUTPUT only part of that data, but you have no real control over the reading -- you get the entire record, period.

This sounds like an easy task to write a program for -- why try to get a SYNCSORT solution when a program would be fairly short and pretty easy to code up?
Robert Sample
Global moderator
 
Posts: 3130
Joined: Sat Dec 19, 2009 8:32 pm
Location: Bellevue, Iowa
Has thanked: 1 time
Been thanked: 185 times

Re: Retrieving records dynamically from dynamic position

Postby enrico-sorichetti » Wed Oct 05, 2016 2:07 am

investgiate the use of the PARSE clause using for the delimiters somenthing like


STARTAT=C'ABC:',ENDAT=C':'


quite a few examples on the forum
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post