|
View previous topic :: View next topic
|
| Author |
Message |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
I have a VB file (LRECL=2199, RECFM=FB) where first two bytes on each record have got length. My requirement is to convert this file to another VB file but excluding the first two bytes, ie., I need to copy the content into another VB file of LRECL 2197 but excluding 1st two bytes. Also, the RDW should have updated length in it. Is this possible with SORT?
Input:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
.Ô200514X1D QMXX1D1RA1G1RA6E41DU112381
.7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Length with 1st two bytes:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
495 | 200514X1D QMXX1D1RA1G1RA6E41DU112381
507 | 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Since first two bytes should be removed, I think it should lessen 4 bytes from RDW !
Expected Output:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
200514X1D QMXX1D1RA1G1RA6E41DU112381
202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Length without 1st two bytes:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
491 | 200514X1D QMXX1D1RA1G1RA6E41DU112381
503 | 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Please help.
Thanks. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| SYNCSORT will maintain the RDW for you so all you have to worry about is copying bytes 7 to end of record to the output . |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| Quote: |
| Since first two bytes should be removed, I think it should lessen 4 bytes from RDW ! |
I sure hope you mean 4 should be subtracted from the length of the record stored in the RDW, because otherwise you've got a problem -- an RDW is 4 bytes, ALWAYS! The first two bytes store the record length and the second two bytes are reserved for use by the system. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
Follow what Nic says. On the 4, as Robert points out, you have confused yourself.
| Code: |
| INREC BUILD=(1,4,7) |
For a VB you always have to place the RDW from the input record to the output record if you are going to change a length (using BUILD or FIELDS). The "7" above says "byte 7 to the end of the current record, whatever that actually is".
SyncSort will then take care of having the correct value in the RDW. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I tried this idea and almost got the results........but am getting wrong RDW on output !!
Actual:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
491 | 200514X1D QMXX1D1RA1G1RA6E41DU112381
503 | 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
But, got below ones
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
492 | 200514X1D QMXX1D1RA1G1RA6E41DU112381
504 | 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Am I need to adjust it further? Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please show your JCL, Sort control cards, and sysout from the step.
Can you explain the output you have shown, and try to show a couple of input records (a cut-down file) and the same records as output, with the RDW. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Without having seen what you are about to post - if you are specifying LREC,BLKSIZE and/or RECFM on your SYSOUT DD statement - don't! Sort will take care of that for you. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Ok Bill.......
| Code: |
//RDW00001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=VB2199.INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=VB2197.OUTPUT.FILE,DISP=SHR
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(1,4,7)
/*
|
Input File:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
.Ã200514X1D QMXX1D1RA1G1RA6E41DU112381
.7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
SYSOUT:
| Code: |
SYNCSORT FOR Z/OS 1.3.2.2R
SYSIN :
OPTION COPY
OUTREC BUILD=(1,4,7)
WER276B SYSDIAG= 148402, 792797, 792797, 1530375
WER164B 6,904K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 2,316,744 BYTES USED
WER146B 12K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=VB ; LRECL= 2199; BLKSIZE= 27998
WER237I OUTREC RECORD LENGTH = 2197
WER110I SORTOUT : RECFM=VB ; LRECL= 2197; BLKSIZE= 27998
WER410B 5,876K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 2,169,288 BYTES USED
WER209B 100 PRIMARY AND 150 SECONDARY SORTOUT TRACKS ALLOCATED, 237 USED
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B SORTIN : EXCP'S=32,UNIT=3390,DEV=3A56,CHP=(2A3C343F4046,2),VOL=XXX999
WER416B SORTOUT : EXCP'S=29,UNIT=3390,DEV=3778,CHP=(2A3C343F4046,1),VOL=YYY199
WER416B TOTAL OF 61 EXCP'S ISSUED FOR COPYING
WER054I RCD IN 16706, OUT 16706
WER169I RELEASE 1.3 BATCH 0506 TPF LEVEL 2.2
|
RDW on Output:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
492 | 200514X1D QMXX1D1RA1G1RA6E41DU112381
504 | 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Thanks. |
|
| Back to top |
|
 |
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
When MicroFocus makes a VB file, the RDW is two-bytes. That may be the source of this file. There is a mainframe utility caled VRECGEN that biulds files that look like this example.
Also, someone may have gotten overzealous in building the LLZZ parts of a GSAM output file and included it in the data portion. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| Quote: |
| //SORTOUT DD DSN=VB2197.OUTPUT.FILE,DISP=SHR |
this tells us that it was a pre-allocated dataset.
how about trying with disp=new?????? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
You only seem to be showing two bytes of "stuff" before the data starts. The RDW (Record Descriptor Word) is four bytes long (that's the "Word" bit, a "Word" being four bytes).
The first two bytes of the RDW are the record-length. The next two bytes are the IOCS and don't get used much (spanned records) so are usually binary zeros.
Ed has made a couple of suggestions. Do they apply in any way to you?
EDIT: The hex values you have at the start of the record don't make sense. 19000+ Please describe where you get the input from, and try to do a hex print including the RDW. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi Ed/Bill,
I am using below code to get RDW !!
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,4,1,2,BI,EDIT=(TTTTT),X,5)
/*
|
Am I wrong? Should it be "1,4,BI,EDIT=(TTTTT)" ?
Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
| Code: |
SORT FIELDS=COPY
INREC BUILD=(1,4,
1,2,BI,EDIT=(TTTTT),
X,
3,2,BI,EDIT=(TTTTT),
X,
9) |
And paste the results with your input file and your output file. Just those two records is fine. You have a test file of 16k records? |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
| Code: |
00492 00000 200514X1D QMXX1D1RA1G1RA6E41DU112381
00504 00000 7202013Y1D QNBY1D1RA1G1RA6E41DU112199
|
Yes.....I have 16k records.
Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
You showed this as your input:
| Code: |
.Ã200514X1D QMXX1D1RA1G1RA6E41DU112381
.7202013Y1D QNBY1D1RA1G1RA6E41DU112199 |
Is this without the RDW? Ie just the data, and the first two bytes are what you want to exclude?
Did you then run the Sort card I asked for the input or the output file? I asked for both. Did you still run it with "5" not "7" or "9"?
Have you run the (1,4,7) for your input file, creating an output file, and still have bytes 5 and 6 from the input?
If you run the BUILD with (1,4,7) on that input, assuming the RDW is not shown, then your two characters should disappear and the record-length in the RDW should be adjusted by Syncsort.
Run this on your input:
| Code: |
SORT FIELDS=COPY
INREC BUILD=(1,4,
1,2,BI,EDIT=(TTTTT),
X,
3,2,BI,EDIT=(TTTTT),
X,
5)
|
Then this, creating an an output file for the next
| Code: |
SORT FIELDS=COPY
INREC BUILD=(1,4,7) |
Then this on the output file.
| Code: |
SORT FIELDS=COPY
INREC BUILD=(1,4,
1,2,BI,EDIT=(TTTTT),
X,
3,2,BI,EDIT=(TTTTT),
X,
5) |
Paste the the results of the first and last on both the input and the output please. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Bill, unfortunately I have lost the dataset. I did not notice that it was residing on temp volume
I am trying to see if I can get similar data !
Thanks a lot for all your suggestions. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|