I would like to use SYNCSORT to read the file and replace x"00' - x'39', x'41'-x'c0', etc. with a period into another file. Both input and output are recfm=PS, recfm=vb, lrecl=26620,blksize=26624. John.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
It will help if you post a few sample input records (usng HEX ON and the Code tag) and the output you want when this sample input is processed. This sample data does not need to be "full length" records (30 or 40 bytes per records should be enough to work with).
Same as the input except that non-print EBCDIC characters (x'00'-x'39', x'41'- x'c0', x'9'-x'd0', x'da'-x'e1', x'ea'-x'ef', and x'fa'-x'ff') are converted to periods (x'4b'). Thanks again.
This can probably be done using REPLACE on the CHANGE subparameter of OUTREC, but the docs are really confusing. I would really appreciate the detail of how to do this. Thanks again.
Untested, but if I read the manual correctly, this should work - first code an ALTSEQ statement to establish the replacement (x'4B') for each character encoding you wish to replace - e.g.
The ALTSEQ control statement also constructs an alternate collating sequence for all control fields processed by the TRAN parameter of the INREC and OUTREC control statements, as well as the TRAN subparameter of the OUTREC parameter on the OUTFIL control statement.
In the OUTREC parameter processing description, the TRAN subparameter is described thusly:
Syncsort wrote:
Use this subparameter to change the case of EBCDIC letters from lowercase to uppercase, uppercase to lowercase, or based on an alternate collating sequence (ALTSEQ) table in effect. Specify this subparameter immediately after the position p and the length l of the field to be converted. Specify p,l,TRAN for both fixed-length records and the fixed-length portion of variable-length records. Specify p,TRAN for the variable-length portion of variable-length records. Starting in position p of the input record, for a length of l, each byte will be converted as per specification.
The above statements from the manual lead me to believe that TRAN with ALTSEQ can be used to accomplish the requested operation.
Ouch. It's apparent that I kinda sorta forgot the correct syntax of OUTREC. Thanks for the correction.
I'm really pleased to have empirical evidence that this solution actually works - both for my own edification, and because there have been quite a few posts in these fora with similar requirements.