Page 1 of 1

OUTREC : Can you use EDIT and SQZ together?

PostPosted: Wed Jun 18, 2014 4:48 pm
by Ewizard
Input field is packed decimal PIC S9(07)V9(02).
0006621
002226C

I convert from this format to zoned decimal using:
7,PD,EDIT=(SIIIIIIT.TT),SIGNS=(,-,,)

I now get:
262622.61
44FFFFFF4FF
00262622B61

As you can see the first 2 bytes are spaces. I know you can use SQZ=(SHIFT=LEFT) to remove these spaces.

Can you combine the EDIT parameter and SQZ parameter within the same OUTREC statement? Or do you need 2 separate SYNCSORT's using OUTREC?

Any help/suggestions much appreciated. :)

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Wed Jun 18, 2014 5:03 pm
by Ewizard
Since the above I have tried:
7,PD,EDIT=(TTTTTTT.TT)

I now get:
0262622.61.

Why do I get '.' at the end? How do I prevent this from displaying?

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Wed Jun 18, 2014 8:06 pm
by BillyBoyo
Yes, you can do it all in one step.

Why you are getting something after the value is extremely difficult to say if you don't show your Control Cards and the input data which gives you that.

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 2:13 pm
by Ewizard
Hi BillyBoyo. Thanks for replying.

Here is the input field in packed format:

7/PS               
(15-21)                           
0006621           
002226C


Here are the control cards:
SORT FIELDS=COPY                           
OUTREC FIELDS=(1:1,10,                     
               C',',                       
               12:15,7,PD,EDIT=(TTTTTTT.TT))


Code'd

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 2:42 pm
by BillyBoyo
SORT FIELDS=COPY                           
OUTREC BUILD=(1,10,                     
              C',',                       
              15,7,PD,
                EDIT=(TTTTTTT.TT))


Can you post the sysout from the step, sample input and output, please?

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 3:20 pm
by Ewizard
Please Note this is just the first few fields of the record as per the Control card as an attempt to see if it worked.

Is this what you want?

Sample Input using option 8.FAM with a copybook for field layout.
2/AN         1/AN    2/AN         1/AN    4/AN  4/AN         SCHED-PREM(1)
(1-2)         (3-3)    (4-5)          (6-6)    (7-10)  (11-14)     (15-21)R
12             /          06             /         2014                                 
FF             6          FF             6         FFFF    4444          0006621
12             1          06             1         2014    0000          002226C


Sysout:
SYSIN :                                                                       
 SORT FIELDS=COPY                                                             
 OUTREC FIELDS=(1:1,10,                                                       
                C',',                                                         
                12:15,7,PD,EDIT=(TTTTTTT.TT))                                 
WER108I  SORTIN   : RECFM=FB   ; LRECL=    99; BLKSIZE= 27918                 
WER073I  SORTIN   : DSNAME=VA.PROD.REASSURE.SCHED.UCGR.M201406               
WER237I  OUTREC RECORD LENGTH =    21                                         
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    22; BLKSIZE= 22000                 
WER074I  SORTOUT  : DSNAME=VA.TEST.REASSURE.SCHED.UCGR.EW1                   
WER462I  OUTPUT LRECL DIFFERS FROM SORTOUT LRECL                             
WER054I  RCD IN       1103, OUT       1103                                   
WER169I  RELEASE 1.4 BATCH 0525 TPF LEVEL 1.0                                 
WER052I  END SYNCSORT - VAEWOS05,JSTEP010,,DIAG=EE00,71C0,C288,00CE,A666,48CB,


Sample Output:
12/06/2014,0262622.61.


Code'd

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 4:09 pm
by BillyBoyo
Yes, except you forgot the Code tags again (use the Quote button on your latest post if you want to see how to get that effect).

Now look at your sysout:

WER108I  SORTIN   : RECFM=FB   ; LRECL=    99; BLKSIZE= 27918                 
...
WER237I  OUTREC RECORD LENGTH =    21                                         
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    22; BLKSIZE= 22000                 
...
WER462I  OUTPUT LRECL DIFFERS FROM SORTOUT LRECL               


Look at the nice BLKSIZE of your input. The optimal blocksize is 27998, so 27918 is closest (when less than) you can get to that.

Now look at the output. 22000. Miles away. Look at the LRECL. 22. Look at the WER237I message. 21. Lookt at the WER462I.

So, from your JCL, remove the LRECL and BLKSIZE (SORT will allocate those) and your spare byte (which if you look in hex was probably X'00') will disappear.

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 4:33 pm
by Ewizard
Thanks BillyBoyo.
That is now fixed.

I am interested to know the syntax for including parameters EDIT and SQZ in the OUTREC statement.

Re: OUTREC : Can you use EDIT and SQZ together?

PostPosted: Thu Jun 19, 2014 6:46 pm
by BillyBoyo
You will EDIT first, and then SQZ. So it is the syntax of SQZ that you need.

I'd use INREC, since you have no actual need to use OUTREC (the main difference is INREC is processed before SORT/SUM, and OUTREC after).

What you may be unaware of is the use of multiple IFTHEN=(WHEN=INIT, which allow for unconditional processing of the record more than once.