How to Extract a string from a VB record



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to Extract a string from a VB record

Postby akjs » Tue Jan 22, 2013 10:54 pm

Hi,

I have requirement to extract data from a variable length record.

Input:
other data<txt>Need to Extract1 <\txt>other dataother data
other dataother datadsfdadsdsa<txt>Need to Extract2 <\txt>dsdasafdda
ohter<txt>Need to Extract3 <\txt>otheresdfasfdas

Output Expected:
Need to Extract1
Need to Extract2
Need to Extract3

Note: The position of <txt> and <\txt> varies record to record.
Could you please suggest me a control card to achieve this using Sort/ICETOOL /ICEMAN

Thanks
akjs
 
Posts: 1
Joined: Tue Jan 22, 2013 10:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Extract a string from a VB record

Postby NicC » Wed Jan 23, 2013 2:15 am

Look up PARSE. Search the forum for examples.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to Extract a string from a VB record

Postby skolusu » Wed Jan 23, 2013 2:23 am

akjs,

use the following DFSORT JCL which will give you the desired results. I assumed the extract text to be 30 bytes. If it is more than that change the value of 'n' in the FIXLEN=n parm.
//STEP0050 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
OTHER DATA<TXT>NEED TO EXTRACT1 <\TXT>OTHER DATAOTHER DATA         
OTHER DATAOTHER DATADSFDADSDSA<TXT>NEED TO EXTRACT2 <\TXT>DSDASAFDDA
OHTER<TXT>NEED TO EXTRACT3 <\TXT>OTHERESDFASFDAS                   
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC PARSE=(%00=(STARTAFT=C'<TXT>',ENDBEFR=C'<\TXT>',FIXLEN=30)),
  BUILD=(%00)                                                       
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post