Page 1 of 1

Question on Parse/Build

PostPosted: Thu Jan 14, 2010 11:39 am
by vespa
I have a wrapped around file that I need to split into single record when X'0D0A' is encountered.
I'm using the Parse/Build command, however, after written out the 1st record, the output file is padding with spaces,
and it didn't split correctly. Did I leave some option out? I also tried the VLTRIM option to check for spaces and it didn't work.

Also, I need to translate the file into ASCII format, do I need a separate step to do this or I can
combine the conversion to ASCII in step 1?

Input: Wrapped around file, RECFM=FB, file length = 80, binary format
Output: Single record, RECFM=FB, record length = 80, ASCII format

Step 1: Split file into one record per line
Step 2: Convert record into ASCII format

Thanks.

Sort parameter
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  OUTFIL PARSE=(%01=(ENDBEFR=X'0D0A',FIXLEN=80)),     
  BUILD=(1:%01)                                       
/*                                                     
//*


Input file:
       ...............................................................................&

33333333333333333333333300222222222222222222222222222222222222222222222222222225

00860912054293305746110100450000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

................................................................................

00333333333333333333333333002022222222222222222222222222222222222222222222222222

DA008609120542933057462201007000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.&.............................&................................................

25003333333333333333333333330025222222222222222222222222222222222222222222222222

00DA0086091205461548224911010080000000000000000000000000000000000000000000000000


1st output file:
...............................................................................&

33333333333333333333333300222222222222222222222222222222222222222222222222222225

00860912054293305746110100450000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

                                                                               

44444444444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.&                                                                             

25444444444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

...&                                                                           

22254444444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.....&                                                                         

22222544444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

.....&                                                                         

22222544444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.......&                                                                       

22222225444444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.........&                                                                     

22222222254444444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

...........&                                                                   

22222222222544444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.............&                                                                 

22222222222225444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

.............&                                                                 

22222222222225444444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

...............&                                                               

22222222222222254444444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.................&                                                             

22222222222222222544444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

...................&                                                           

22222222222222222225444444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000

 ------------------------------------------------------------------------------

.....................&                                                         

22222222222222222222254444444444444444444444444444444444444444444444444444444444

00000000000000000000000000000000000000000000000000000000000000000000000000000000


After convert to ASCII format, display of record should looks like:
008609120542933057461101..$%                                            P
008609120542933057462201..'.                                            P

Re: Question on Parse/Build

PostPosted: Fri Jan 15, 2010 12:13 am
by Frank Yaeger
Sorry, but it isn't clear to me what you're trying to do. Is the 1st output file data you show what you want or what you got?

Are you trying to do something like this where dl=X'0D04' delimiter (I didn't go all the way up to column 80 but hopefully you get the idea):

Input records:

AAAAAAAAAAAAdlBBBBBBBBBBBBBdlCdlDDDDD
DDDDDDdlEEEEEEEEEEEEEEEEEEEEEEdlFdlGG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG


Output records:

AAAAAAAAAAAAdlBBBBBBBBBBBBB
C
DDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEE
F
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GG


If so, what exactly are the rules for breaking up the records?

If you're trying to do something else, please show a better example (in the same format as the one I showed) and explain the rules for breaking up the records.

Re: Question on Parse/Build

PostPosted: Mon Jan 18, 2010 11:44 pm
by vespa
Frank, sorry for the confusion. You're correct, I need to break the file when encountered CRLF, dl='ODOA'.
The output file that I'd provided was what I had when I ran the job, and it didn't break correctly.
I think the parameter should be pretty straight forward but what I have doesn't work.
Thanks.

Sort parameter:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  OUTFIL PARSE=(%01=(ENDBEFR=X'0D0A',FIXLEN=80)),     
  BUILD=(1:%01)                                       
/*                                                     
//*


Input file, RECFM=FB, record length = 80

                                                                               &

33333333333333333333333300222222222222222222222222222222222222222222222222222225

00860912054293305746110100450000000000000000000000000000000000000000000000000000

-------------------------------------------------------------------------------

                                                                               

00333333333333333333333333002022222222222222222222222222222222222222222222222222

DA008609120542933057462201007000000000000000000000000000000000000000000000000000

-------------------------------------------------------------------------------

 &                             &                                               

25003333333333333333333333330025222222222222222222222222222222222222222222222222

00DA0086091205461548224911010080000000000000000000000000000000000000000000000000

-------------------------------------------------------------------------------

   &                             &                                             

22250033333333333333333333333300252222222222222222222222222222222222222222222222

0000DA00860912054615482249220100400000000000000000000000000000000000000000000000

-------------------------------------------------------------------------------

     &                                                                         

22222500333333333333333333333333000022222222222222222222222222222222222222222222

000000DA008609120553405793081101009000000000000000000000000000000000000000000000


Output file, RECFM=FB, record length = 80 and should looks like:

000001                                                                                &

       33333333333333333333333300222222222222222222222222222222222222222222222222222225

       00860912054293305746110100450000000000000000000000000000000000000000000000000000

--------------------------------------------------------------------------------------

000002                                                                                &

       33333333333333333333333300202222222222222222222222222222222222222222222222222225

       00860912054293305746220100700000000000000000000000000000000000000000000000000000

--------------------------------------------------------------------------------------

000003                            &                                                   &

       33333333333333333333333300252222222222222222222222222222222222222222222222222225

       00860912054615482249110100800000000000000000000000000000000000000000000000000000

--------------------------------------------------------------------------------------

000004                            &                                                   &

       33333333333333333333333300252222222222222222222222222222222222222222222222222225

       00860912054615482249220100400000000000000000000000000000000000000000000000000000

--------------------------------------------------------------------------------------

000005                                                                                &

       33333333333333333333333300002222222222222222222222222222222222222222222222222225

       00860912055340579308110100900000000000000000000000000000000000000000000000000000

Re: Question on Parse/Build

PostPosted: Tue Jan 19, 2010 12:17 am
by Frank Yaeger
PARSE only works on one line at a time - it doesn't wrap to the next line. I don't see a way to do what you want with built-in features of DFSORT. I'd suggest using a program or exit of your own with the logic you need.