|
View previous topic :: View next topic
|
| Author |
Message |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
| 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. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

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). |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
| Code: |
Record 1:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 2011,033,11,46,50,aaaaaaa ,bbbbbbb ,cccccccc,dddddddd,eeeeeeee,fffffff ,
FFFF6FFF6FF6FF6FF6888888846888888846888888886888888886888888886888888846
2011B033B11B46B50B11111110B22222220B33333333B44444444B55555555B66666660B
--+----8----+----9----+----0----+----1----+----2----+----3----+----4----
gggg , ,A, É, É,Gá¼K óÉ $É,AGCC.I00MA.R.1___12345678_______
88884444606C60007600076C4BD0C70000002576CCCC4CFFDC4D4F666FFFFFFFF6666666
77770000B1B1B8021B8021B7572BE14000061B1B1733B90041B9B1DDD12345678DDDDDDD
+----5----+----6----+----7----+----8----+----9----+----0----+----1----+-
_________ECECCAEC________________NNNN___________________________________
666666666CCCCCCCC6666666666666666DDDD66666666666666666666666666666666666
DDDDDDDDD53533153DDDDDDDDDDDDDDDD5555DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Record 2:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000002 2011,033,11,46,50,aaaaaaa ,bbbbbbb ,cccccccc,dddddddd,eeeeeeee,fffffff ,
FFFF6FFF6FF6FF6FF6888888846888888846888888886888888886888888886888888846
2011B033B11B46B50B11111110B22222220B33333333B44444444B55555555B66666660B
--+----8----+----9----+----0----+----1----+----2----+-
gggg , ,A, M, M,Gá¼K Î $=,
88884444606C6000D6000D6C4BD07C0000002576F4444444444444
77770000B3B1B8014B8014B7572D6A1000061BEBF0000000000000
|
[/code] |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
And the desired output? |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
| 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. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You can to do what you want using FINDREP. |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
| 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. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Did you read about FINDREP? It appears to be rather straightforward from the manual. . .
The way i read the manual, CHANGE won't be what you want. . . So, it would appear confusing. . . |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
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.
| Code: |
ALTSEQ CODE=(004B,014B,...,394B,414B,...,C04B,...,etc) |
Then
| Code: |
SORT FIELDS=COPY
OUTREC=(4,TRAN=ALTSEQ) |
|
|
| Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Ronald,
ALTSEQ Specifies an alternate collating sequence for control fields with an
AQ format.
Im not sure it can be used to replace something. As far as i understood the manual its used in combination with SORT/MERGE. |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Peter, The Syncsort Manual says this:
| Syncsort wrote: |
| 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. |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
The following works:
| Code: |
SORT FIELDS=(COPY)
INREC OVERLAY=(99:99,26620,TRAN=ALTSEQ)
ALTSEQ CODE=(004B,014B,024B,034B,044B,054B,064B,074B,
084B,094B,0A4B,0B4B,0C4B,0D4B,0E4B,0F4B,
104B,114B,124B,134B,144B,154B,164B,174B,
184B,194B,1A4B,1B4B,1C4B,1D4B,1E4B,1F4B,
204B,214B,224B,234B,244B,254B,264B,274B,
284B,294B,2A4B,2B4B,2C4B,2D4B,2E4B,2F4B,
304B,314B,324B,334B,344B,354B,364B,374B,
384B,394B,3A4B,3B4B,3C4B,3D4B,3E4B,3F4B,
414B,424B,434B,444B,454B,464B,474B,
484B,494B,
514B,524B,534B,544B,554B,564B,574B,
584B,594B,
624B,634B,644B,654B,664B,674B,
684B,694B,6A4B,
704B,714B,724B,734B,744B,754B,764B,774B,
784B,794B,
804B,
8A4B,
904B,
9A4B,9B4B,9C4B,9D4B,9E4B,9F4B,
A04B,A14B,
AA4B,AB4B,AC4B,AD4B,AE4B,AF4B,
B04B,B14B,B24B,B34B,B44B,B54B,B64B,B74B,
B84B,B94B,BA4B,BB4B,BC4B,BD4B,BE4B,BF4B,
C04B,
CA4B,CB4B,CC4B,CD4B,CE4B,CF4B,
D04B,
DA4B,DB4B,DC4B,DD4B,DE4B,DF4B,
E04B,E14B,
EA4B,EB4B,EC4B,ED4B,EE4B,EF4B,
FA4B,FB4B,FC4B,FD4B,FE4B,FF4B)
|
however, it makes all output records the maximum size with trailing spaces. Any suggestions |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
According to the manual, if you changed
99:99,26620,TRAN=ALTSEQ
with
99:99,TRAN=ALTSEQ
without the length specification, it should take from 99 to the end of record (variable length)
worth a try???? |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
I tried it two ways:
| Code: |
SORT FIELDS=(COPY)
INREC OVERLAY=(99:99,,TRAN=ALTSEQ)
*
WER268A INREC STATEMENT : SYNTAX ERROR
SORT FIELDS=(COPY)
INREC OVERLAY=(99:99,TRAN=ALTSEQ)
*
WER268A INREC STATEMENT : SYNTAX ERROR
|
[/code] |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
| Did you try it with a simple OUTREC statement (as I posted originally), rather than using OVERLAY? |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
| How can I omit the overlay and preserve the first 95 bytes? |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Well, if OVERLAY starts in column 99, then you are really only preserving the first 94 positions (plus the RDW). To do that with OUTREC, code
OUTREC=(1,98,99,TRAN=ALTSEQ) |
|
| Back to top |
|
 |
John Howard
New User
Joined: 03 Aug 2007 Posts: 27 Location: Florida
|
|
|
|
That worked, but I had to add FIELDS=
| Code: |
OUTREC FIELDS=(1,98,99,TRAN=ALTSEQ)
|
Thanks for the help. J |
|
| Back to top |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
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. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|