|
View previous topic :: View next topic
|
| Author |
Message |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Hi,
Could someone please suggest me the feasibility or what option to use in Sort to get the below task done
A PS VB File, LRECL=16 has got around 30 lakh records, having two header and trailer. The entire data is encrypted
somewhat like
| Code: |
iã(ääêß&è...
....uãå...¼Ë
#×Hç%Jþ..Ê1¸
.¸q..¿.9,Wÿé
¡4Þþo.. Nz./
Ë..ôú´.¦.QÅÚ
M>é..+ª4ãpà.
....B3À§¡.àè
°´Ô.0.2±T..`
.ôç\..Ó.ÐÅÀÏ
Íätì.w.Î.lú
-\.8..ø..QðF
.
.
.
.
..ݶ.°ê.iã(ä |
.
| Code: |
iã(ä IS Header Record here,
|
Is it possible to split the file into two files using SORT
The first file will start from Header, data and should end copying after it gets the encrypted header again.
Likewise, it should copy the entire content from the second header encountered till end of file
Any suggestions on how to approach please. |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Try this.
Note : X'C966B14D669F' in the code is a hex value of iã(ä. This may be incorrect, Check the exact Hex value of your header, give it accordingly
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=VBFILE,DISP=SHR
//F1 DD DSN=VBFILE.OUT1,DISP=SHR
//F2 DD DSN=VBFILE.OUT2,DISP=SHR
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C' ',5)),
IFTHEN=(WHEN=GROUP,BEGIN=(6,6,CH,EQ,X'C966B14D669F'),
PUSH=(5:ID=1))
OUTFIL FNAMES=F1,INCLUDE=(5,1,CH,EQ,C'1'),
BUILD=(1,4,6)
OUTFIL FNAMES=F2,INCLUDE=(5,1,CH,GT,C'1'),
BUILD=(1,4,6)
OPTION COPY
/*
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Maghesh,
That's close, but a couple of things:
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C' ',5)),
IFTHEN=(WHEN=GROUP,BEGIN=(6,6,CH,EQ,X'C966B14D669F'),
PUSH=(5:ID=1))
OUTFIL FNAMES=F1,INCLUDE=(5,1,CH,EQ,C'1'),
BUILD=(1,4,6)
OUTFIL FNAMES=F2,SAVE,
BUILD=(1,4,6)
|
EDIT: Include the correct BUILD on the OUTFIL with SAVE.
The other thing is the VB aspect. They all seem to be 16. So are they FB with an RDW, or truly VB? We should ask. |
|
| Back to top |
|
 |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Thanks Magesh and Bill,
Jus wanted to confirm the dataset attributes below
| Code: |
Organization . . . : PS
Record format . . . : VB
Record length . . . : 16
Block size . . . . : 6144
1st extent tracks . : 1071
Secondary tracks . : 5000
Data set name type :
SMS Compressible. . : NO |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You've shown 12 bytes of data for each sample record.
If all the data is 12 bytes, no need for it to be V-type records.
Unless required for the processing.
At the moment, with no further information, you are wasting 25% of the used DASD by having X'000C0000' prefixing each record. |
|
| Back to top |
|
 |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Thanks Bill and Magesh,
The VB File here is required for processing so we need to keep the VB format.
For the solution, I am taking first 4 bytes of header into consideration as
for the first record in file the header gets accommodated in the first line,
but the header may get split when appearing next time as I showed in the file snippet previously.
The hex value for first 4 bytes are X'89464D43'
On running the code below, the entire data is getting copied to F2,
and F1 is coming as Blank.
If you could please suggest where am I going wrong
| Code: |
//SRT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.ENCRYPT.JUN1515,DISP=SHR
//F1 DD DSN=OUTPUT.F1X,DISP=SHR
//F2 DD DSN=OUTPUT.F2X,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C' ',5)),
IFTHEN=(WHEN=GROUP,BEGIN=(5,4,CH,EQ,X'89464D43'),
PUSH=(5:ID=1))
OUTFIL FNAMES=F1,INCLUDE=(5,1,CH,EQ,C'1'),
BUILD=(1,4,6)
OUTFIL FNAMES=F2,SAVE,
BUILD=(1,4,6)
/* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
This value, X'89464D43', does not occur on any record in your data at position five.
Wow. I can't understand ho we didn't pick up that the second occurrence could appear anywhere. You didn't mention it after all, and I for one didn't look at the scrumble-jumble data to verify what you did say.
| Code: |
OPTION COPY,STOPAFT=1
OUTFIL VTOF,BUILD=(5,4,TRAN=HEX,C'''') |
Run that and post the output please.
Can the second header value be split across a record? |
|
| Back to top |
|
 |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Hi Bill,
I ran the below job
| Code: |
//SRT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD DSN=INPUT.ENCRYPT.JUN1515,DISP=SHR
//SORTOUT DD DSN=OUTPUT.ENCRYPT.NEW,
// DISP=(NEW,CATLG,CATLG),
// UNIT=DISK,VOL=(,,,5),
// SPACE=(TRK,(1,1))
//SYSIN DD *
OPTION COPY,STOPAFT=1
OUTFIL VTOF,BUILD=(5,4,TRAN=HEX,C'''')
/*
//*
|
And the SORTOUT dataset has got below values
| Code: |
********************************* Top of Data **********************************
89464D43'
******************************** Bottom of Data ********************************
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Wood for the trees. Change this BEGIN=(5,4,CH,EQ,X'89464D43') to BEGIN=(6,4,CH,EQ,X'89464D43').
And you didn't answer the question about the second header. |
|
| Back to top |
|
 |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Thanks Bill - The second header would not split, but its position might get alter by a column or two.
On changing to BEGIN=(6,4,CH,EQ,X'89464D43') I got all data in File 1 and File 2 gets empty... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You can use OR in BEGIN and you can use SS in BEGIN. The SS is clearer, the OR can be more efficient if you have loads of records.
For the OR, use same test, different start-positions (like 7, 8, 9, however many you want).
For the SS, specify start-position of 6, and length being the maximum number of bytes before the key can be encountered (like 7 with the same example for the OR). |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| Quote: |
| The entire data is encrypted |
if they are happy we are happy
( really we do not care )
IMO mucking around with encrypted data is really inconsiderate
I wonder what the AUDIT has to say about it |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I have to agree with enrico. It's a mugs' game. Can't even see the header indicator, so can't evaluate chance of false hits.
How do you verify the data hasn't been "edited". You don't need to, because you know it has.
The split should be before the encryption. You can (perhaps, subject to false-hits) do it this way in the short term (during testing to get things going, for instance) but it should not be a medium-/long-term/permanent task.
If you're feeling twitchy about false-hits (I would) then I'd suggest three OUTFILs, SAVE on one (always expected to be "empty") and select for 1 on the first and 2 on the second.
Use NULLOFL on the OUTFIL for 2 (one RC=) and the OUTFIL with SAVE (a different RC=). Then you can deal with all possible combinatons (if you get the RC= in the correct order). |
|
| Back to top |
|
 |
shiitiizz
New User

Joined: 12 Sep 2013 Posts: 22 Location: India
|
|
|
|
Bill / Enrico - Thanks for your comments, Although am able to split using 'OR' on BEGIN and checking for various combinations, I agree chance of false hit is high.
Bill - Honestly I did not get the suggestion but I am going to refer some Manuals and try to work that out fo sure, I will post if am able to pen it down. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
NULLOFL on OUTFIL allows the output of a (limited values) Return Code when the OUTFIL dataset is empty.
With NULLOFL on three OUTFILs you can for instance get an RC=4 for when your SAVE OUTFIL is empty, which it always should be, and RC=12 for when your second OUTFIL is empty (which it should never be). When your first OUTFIL is empty, your second must be empty as well, so you'd still get RC=12.
The highest RC= will be output, so the RC=4 is the least significant one. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|