Page 1 of 1

Computing length of given PIC clause

PostPosted: Fri Jun 27, 2008 3:17 pm
by kamal
The requirement is like
PICTURE--    FLD  START     END  LENGTH
9(10)V9(10)    2     81      91      11

I want to find out such records from a long list given in above format,
for which the PIC length for 9(10)V9(10) ( 10 + 10 = 20 ) is greater than the value given in length column(11).
i.e. 20 > 11.

Can this be done using DFSORT ?
The Input list goes like:
PICTURE--    FLD  START     END  LENGTH
X(80)          1      1      80      80
9(10)V9(10)    2     81      91      11
X(4)           3     92      95       4
9(14)          4     96     109      14
9(4)           5    110     113       4
X(14)          6    114     127      14
9(8)           7    128     132       5


Out of these only rec 2 and 7 fit in the condition said above.
These records should be identified.

Re: Computing length of given PIC clause

PostPosted: Fri Jun 27, 2008 8:57 pm
by Frank Yaeger
Is the header (PICTURE ...) actually in the input file?

What do you want the output to look like exactly?

What is the RECFM and LRECL of the input file.

Are there always either one "(x)' item or two '(x)' items in the PICTURE format
or are there other variations that might appear that you haven't mentioned (I don't know COBOL).

Re: Computing length of given PIC clause

PostPosted: Mon Jun 30, 2008 11:44 am
by kamal
Input file Length 200 ;FB
Pic claused are always "(x)" /"(xx)" depending upon the length.
just the fileds should be identified.

Would be great if o/p format is same as i/p with a char 'Y' after three places of last char for identified records(using said condition(s)).Shown below:
PICTURE--    FLD  START     END  LENGTH
X(80)          1      1      80      80
9(10)V9(10)    2     81      91      11   Y
X(4)           3     92      95       4
9(14)          4     96     109      14
9(4)           5    110     113       4
X(14)          6    114     127      14
9(8)           7    128     132       5   Y

Re: Computing length of given PIC clause

PostPosted: Mon Jun 30, 2008 10:20 pm
by dick scherrer
Hello,

What about fields defined as 999 or 999v9 etc?

Re: Computing length of given PIC clause

PostPosted: Tue Jul 01, 2008 2:11 am
by skolusu
The Following DFSORT JCL will give you the desired results. I just assumed that you only 2 fields definitions which are enclosed in parenthesis. If you have more than 2 we can adjust the job.

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
PICTURE--    FLD  START     END  LENGTH                     
X(80)          1      1      80      80                     
9(10)V9(10)    2     81      91      11                     
X(4)           3     92      95       4                     
9(14)          4     96     109      14                     
9(4)           5    110     113       4                     
X(14)          6    114     127      14                     
9(8)           7    128     132       5                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION SKIPREC=1                                         
  SORT FIELDS=COPY                                         
  INREC PARSE(%00=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=5),   
              %01=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=5)),   
            OVERLAY=(201:%00,UFF,EDIT=(TTTTT),             
                         %01,UFF,EDIT=(TTTTT),             
                         201,5,ZD,ADD,206,5,ZD,EDIT=(TTTTT),
                         35,5,UFF,EDIT=(TTTTT))             
  OUTREC IFOUTLEN=200,                                     
  IFTHEN=(WHEN=(211,5,ZD,NE,216,5,ZD),OVERLAY=(45:C'Y'))   
//*                                                         


Hope this helps...

Cheers

Re: Computing length of given PIC clause

PostPosted: Tue Jul 01, 2008 5:51 pm
by kamal
What about fields defined as 999 or 999v9 etc?

dick scherrer this situation won't be there

Pic claused are always "(x)" /"(xx)" depending upon the length.

so it will be 9(3) or 9(3)v9(1)

Re: Computing length of given PIC clause

PostPosted: Tue Jul 01, 2008 8:14 pm
by dick scherrer
Hello,

Then you should be "good to go" :)

Thanks for letting us know.

d