Page 1 of 2

How to reformat

PostPosted: Fri Aug 16, 2013 12:36 pm
by deva_048
My input dataset looks like below

----+----1----+----2----+----3----+----4----+----5----+----6----+
********************************* Top of Data *******************
  JOBDD413                    --------- STRING(S) FOUND         
-------------------                                             
       2  AFILE=I00.YYYY.DATA                               
       3  FILE=B_TEST_.DATA             
  JOBDD414                    --------- STRING(S) FOUND         
-------------------                                             
       2  AFILE=I01.YYYY.DATA                                 
       3  FILE=A_TEST_.DATA             


Output dataset should be:
JOBDD413      I00.YYYY.DATA   B_TEST_.DATA
JOBDD414      I01.YYYY.DATA   A_TEST_.DATA


Is it possible? I tried outrec but cant get the expected ouput .. please help me on this

Re: How to reformat

PostPosted: Fri Aug 16, 2013 1:09 pm
by BillyBoyo
Yes, it is possible. Which SORT product do you use (your topice can be moved to the appropriate place here)?

To get data from one record to another you need IFTHEN=(WHEN=GROUP. You will need two of them. Is your data entirely regular ase shown? Strictly one 2 and one 3 and nothing else per JOBxxxxx, and all JOBxxxxx starting with JOB?

Re: How to reformat

PostPosted: Fri Aug 16, 2013 2:29 pm
by deva_048
JOB name which will start with prefix JOBxxxxx.
Sort product Details:
SYNCSORT FOR Z/OS 1.4.1.0R

Yes, my data looks like mentioned in input dataset.

Re: How to reformat

PostPosted: Fri Aug 16, 2013 2:53 pm
by BillyBoyo
First, you need an INCLUDE COND= which will get you the records you want and keep the other stuff out of the way. You'll need at least one OR.

Take care that the data is reliably identified - although it doesn't matter in this example, it may in another.

Once you can show that working, we can get to the next bit.

Re: How to reformat

PostPosted: Fri Aug 16, 2013 2:58 pm
by deva_048
Can you please show the sample code to acheive the output? I have tried include cond to satisfy first 3 columns contain name JOB to retrieve the records and do not know how to write the data files name in same line...

Re: How to reformat

PostPosted: Fri Aug 16, 2013 3:07 pm
by BillyBoyo
  INCLUDE COND=(start,length,type,value,
             OR,start1,length1,type1,value1)

Re: How to reformat

PostPosted: Fri Aug 16, 2013 3:38 pm
by deva_048
thanks billy. i will work it out and let you know..

Re: How to reformat

PostPosted: Fri Aug 16, 2013 3:44 pm
by deva_048
Tried below code. not getting my expected output
INCLUDE COND=(3,3,CH,EQ,C'JOB',OR,
           11,5,CH,EQ,C'AFILE',OR,
           11,4,CH,EQ,C'FILE')     
OUTREC FIELDS=(1:2,10,15:17,40)   
SORT FIELDS=COPY

Re: How to reformat

PostPosted: Fri Aug 16, 2013 4:56 pm
by BillyBoyo
Take out the OUTREC.

The INCLUDE is fine. I would use 2,4,CH,EQ,C' JOB' and check for AFILE= and FILE= (increasing the lengths appropriately). Reduces the chance of an "accidental hit". Doesn't matter with your data, but for the next one, or the one after that....

Without the OUTREC, you should get just the three lines with the information that you want.

  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,4,CH,EQ,C' JOB'),
                         PUSH=(81:2,7))


Look at the output that you get. Your three records which are part of the GROUP now have the information from the first record. You need to do something similar to get the data from the second record on to the third (without blatting the data from the first). Then you can format the third record, and use OUTFIL OMIT= to discard the no-longer required first two records of each group.

Re: How to reformat

PostPosted: Fri Aug 16, 2013 5:44 pm
by deva_048
Yes i can able to group it ... finally how to outfil the record grouped lines into a single line

----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
********************************* Top of Data *************************
 JOBDD413                    --------- STRING(S) FOUND         JOBDD413
      2  LFILE=I00.I0021102.DATA                               JOBDD413
      3  FILE=/home/user/A_MEM.DATA                            JOBDD413


How to get the below expected into a single line by above grouping..

JOBDD413  I00.I0021102.DATA  A_MEM.DATA