|
View previous topic :: View next topic
|
| Author |
Message |
snehal
New User
Joined: 12 Dec 2006 Posts: 14 Location: pune
|
|
|
|
Hi,
I have to delete first occurence of string from input file (Record format : VBA and LRECL=1024). I want to search particular hex value in the file and omit only that record.
Can anyone help me to solve this?
Thanks,
Snehal |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Does the HEX value occur in any position? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Which do you want to do? Omit a record or delete some data?
Can you show some sample input and expected output, please?
SS on OMIT/INCLUDE or FINDREP are likely to be what you want, but as Pandora-Box is hinting, if you are going for a hex value, you have to be really sure it can't just exist naturally in a packed/binary field on a record. |
|
| Back to top |
|
 |
snehal
New User
Joined: 12 Dec 2006 Posts: 14 Location: pune
|
|
|
|
Hi Bill,
Hex value will pe at position 1 in the file. But it doesn't appear only in one record. It can be present in many records.
I want to delete record when the hex value appears first time.
I tried below card :
| Code: |
//SYSIN DD *
OPTION COPY,STOPAFT=1
OMIT COND=(5,3,SS,EQ,X'4E065E')
/* |
But it didn't work.
Data from I/P file: I put HEX ON in file
| Code: |
DJDE âáåñ+,,,,,,,,,,,,,à
44444444CDCC44444432323323233224
00000000414502579ED80E00C0E009C4
--------------------------------
+,;,,2,,,,,,,,,,
4444444440500F00022222204444444444444444
00000000E6E042C0500000010000000000000000
--------------------------------
DJDE ãááà, íì,á+à,
44444444CDCC44444345524443444444
00000000414506554D158C5E4B000000
--------------------------------
1,,
F2044444444444444444444444444444
10100000000000000000000000000000
--------------------------------
+,;,,2,,,,,,,,,,
4444444440500F00022222204444444444444444
00000000E6E042C0500000010000000000000000
|
I want to delete record where first occurrence of Hex value X'4e065e' is found.
Thanks,
Snehal |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, you won't be able to use INCLUDE/OMIT.
You could use IFTHEN=(WHEN=(logexp with SS and OVERLAY a SEQNUM, then on OUTFIL OMIT get rid of the record which has a sequence number of one, and shorten the records to drop the sequence number. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
This should get you what needed...
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(6,3,CH,EQ,X'4E065E'),
PUSH=(1025:ID=4,1029:SEQ=8))
OUTFIL OMIT=(1025,4,ZD,EQ,1,AND,1029,8,ZD,EQ,1),BUILD=(1,1024)
|
|
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
May be slightly better
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(5,3,CH,EQ,X'4E065E'), RECORDS=1,
PUSH=(1025:ID=4))
OUTFIL OMIT=(1025,4,ZD,EQ,1,AND,5,3,CH,EQ,X'4E065E'),BUILD=(1,1024) |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What's going on here? TS's data doesn't match their words, and we're coming with code? :-)
The test data shown is variable-length.
The hex value (which is actually "+,;"), where it is shown, is at a fixed position (despite the request to "search") of 13,3 in a VBA.
I don't know why the GROUP is being used. Why not logexp and a simple OVERLAY (there is no need to propagate data across other records, or to use ID, or whatever, unless I'm missing something).
Padora-Box at least has RECORDS=1 (although, as a comment, through typo).
Isn't all we need to know is that it is the first occurrence of the thing? No need for first occurrence of first group, is there? |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I used a GROUP and records=1 because we dont need to overlay all the records and we can pick the first OVERLAYed record
| Quote: |
| Escapa at least has RECORDS=1 (although, as a comment, through typo). |
It was me  |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Sorry, mixed up with the "Topic Review". Corrected.
Why GROUP at all, was the main question. |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I used GROUP for RECORDS=1 because RECORDS=n is supported only in group just to ensure overlaying all records not needed
But yes GROUP is not needed an overlay with SEQUENCE number should suffice
I was looking for something like to mix STOPAFT=1 & OVERLAY so that just to remove 1 record we dont need to overlay for all or even few
Still thinking on that .. I am not sure atm if its possible |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| Escapa wrote: |
| This should get you what needed... |
| Pandora-Box wrote: |
| May be slightly better |
I really appreciate your enthusiasm to help with solutions, but please pay attention to RECFM of OP. Both of your solutions will make all the records in the Variable block file to have the max length , there by ruining the very concept of VB files. Try displaying the RDW before and after your jobs and see how the RDW is updated to the max value. Moreover you have complicated a simple request. You really don't need WHEN=GROUP in here.
| Bill Woodger wrote: |
| The hex value (which is actually "+,;"), where it is shown, is at a fixed position (despite the request to "search") of 13,3 in a VBA. |
For VBA files the actual data starts in position 6 as the first 5 bytes have( 4 bytes RDW + 1 byte Carriage control character). So if you add a seqnum for 8 bytes the search key begins at 14.
snehal,
Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your Input VBA file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,5)),
IFTHEN=(WHEN=(14,3,CH,EQ,X'4E065E'),OVERLAY=(5:SEQNUM,8,ZD))
OUTFIL OMIT=(5,8,ZD,EQ,1),BUILD=(1,4,13)
//* |
|
|
| Back to top |
|
 |
snehal
New User
Joined: 12 Dec 2006 Posts: 14 Location: pune
|
|
|
|
Thanks a lot Skolusu.
Solution given by you worked fine for me.
Snehal |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks Kolusu
I was aware of this solution but I had a wrong assumption about my solution |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|