SPLIT input records based on the given delimiter



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

SPLIT input records based on the given delimiter

Postby gopal_NKP » Fri May 03, 2013 7:45 am

Hi,

The file is having in the below given format. The characters after CRLF should continue in the next line as next record. The position of CRLF is not constant to any column.

INput File: (in VB format with LRECL=351)
1111111111111111111111111CRLF222222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222CRLF33333333333333333333333333333333333333333333333333333333333333333333333
3333333333333333333333333CRLF444444444444444444444444444444444444444444444444444444444444444CRLF55555555555555


Expected output (in VB format with LRECL=351):
111111111111111111111
222222222222222222222222222222222222222222222222222222
333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444
5555555555555555555555555

Could you please help me to achieve the expected output?
gopal_NKP
 
Posts: 22
Joined: Fri Feb 25, 2011 11:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: SPLIT input records based on the given delimiter

 

Re: SPLIT input records based on the given delimiter

Postby NicC » Fri May 03, 2013 2:27 pm

What have you tried so far? And in what way did these experiments not achieve what you wanted?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: SPLIT input records based on the given delimiter

Postby BillyBoyo » Fri May 03, 2013 3:27 pm

How many CRLFs might you have per record?

Can data for one "output record" be contained on two or more input records?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SPLIT input records based on the given delimiter

Postby gopal_NKP » Fri May 03, 2013 3:53 pm

Hi,

Once record contains one CRLF character in the input file.
gopal_NKP
 
Posts: 22
Joined: Fri Feb 25, 2011 11:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: SPLIT input records based on the given delimiter

Postby BillyBoyo » Fri May 03, 2013 4:15 pm

OK, look at PARSE, with ENDBEFR=X'crlf' and FIXLEN=347. You'll need two PARSEd fields.

You'll need an OUTFIL which will allow you to use the "slash operator", /, to output more than one record from one input record. You'll probably want to use VLTRIM to drop the trailing blanks which would otherwise exist (I'm guessing you won't have any "genuine" trailing blanks due to the way the file has been created).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SPLIT input records based on the given delimiter

Postby skolusu » Fri May 03, 2013 10:58 pm

Gopal,

You need to fix your process that sent the file. If you FTP'ed the file from open system to mainframe, take a look at the SITE command where you can specify the file DCB properties. Once you specify that you don't even split the records based on the CRLF.


BillyBoyo wrote:OK, look at PARSE, with ENDBEFR=X'crlf' and FIXLEN=347. You'll need two PARSEd fields.

You'll need an OUTFIL which will allow you to use the "slash operator", /, to output more than one record from one input record. You'll probably want to use VLTRIM to drop the trailing blanks which would otherwise exist (I'm guessing you won't have any "genuine" trailing blanks due to the way the file has been created).


Bill,

There is more to just parsing. Look at the records 222222, 33333 and 4444..... They are all spread across 2 records. Along with parsing we need to merge the split records into a single record which will be a difficult task. OP just need to fix his FTP parms which would automatically take care of the issue.
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

Re: SPLIT input records based on the given delimiter

Postby BillyBoyo » Sat May 04, 2013 3:16 am

Well, I did ask about that. Although no specific answer, the "one CRLF per record" seemed to indicate that the data was not as shown (two CRLFs on the last sample record).

Yes, much better to get it fixed :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SPLIT input records based on the given delimiter

Postby gopal_NKP » Tue May 07, 2013 7:04 pm

Hi,

Thanks to all of you for your help.
The file is the result of a PGP decryption. We receive file in encrypted format and process it after decryption.
gopal_NKP
 
Posts: 22
Joined: Fri Feb 25, 2011 11:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: SPLIT input records based on the given delimiter

Postby BillyBoyo » Tue May 07, 2013 8:03 pm

OK, pretend earch sub-record on a record is a maximum of 10 bytes long, then show some sample input and expected output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post