View previous topic :: View next topic
|
Author |
Message |
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
Can someone help me with the following requirement?
I need to search all occurences of a record and see if any occurence has a current date, then it should be written to output file.
Code: |
01 DATA1.
05 STATIC-AREA.
10 A PIC X(01).
10 B PIC X(10).
10 OCCURS-CNT PIC 9(04) VALUE 1000.
05 DYNAMIC-AREA.
10 DATA2 OCCURS 0 TO 1000 DEPENDING ON OCCURS-CNT.
15 FIELD1 PIC X(10).
15 FIELD2 PIC X(10).
15 DATE1 PIC X(10).
15 FIELD3 PIC X(10).
|
We can have DATA2 occurring 10 times or 100 times and if any occurence has DATE1 = CURRENT DATE, then it needs to be written in the output file. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. |
|
Back to top |
|
|
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
My input will be something as follows:
Code: |
4 A 2 A
5 B 7 1234567890
11 OCCURS-CNT 81 03
14 FIELD1(1) 84 AAAAAAAAA
19 FIELD2(1) 106 1
23 DATE1(1) 139 20090714
31 DATE2(1) 207 20100714
14 FIELD1(2) 231 AAAAAAAAB
19 FIELD2(2) 253 1
23 DATE1(2) 286 20090614
31 DATE2(2) 354 20100614
14 FIELD1(3) 378 AAAAAAAAC
19 FIELD2(3) 400 4
23 DATE1(3) 433 20090905
31 DATE3(3) 501 20100419
|
The Input will is VB; 26000 bytes;
In the above example if any of the DATE1 dates i.e. DATE1(1) or DATE1(2) or DATE(3) has today's date then this whole record should be written in Output file else skip this record and check the next record. So in above example as the date in DATE1(3) is today's date, it should be written into output file.
I have been doing this comparison using a COBOL code but wanted to see if it was possible thru ICETOOL / SORT.
Appreciate your help in this regard. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Assuming you only have the date in the DATE1 field and not in FIELD1, FIELD2 or FIELD3, you could use a "brute force" DFSORT job like the following to do what you asked for. But it doesn't actually use OCCURS-CNT as your program probably does, so your program might be more efficient.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
TARG1,S'&YR4.&MON.&DAY'
/*
//SORTIN DD DSN=... input file (VB/26000)
//SORTOUT DD DSN=... output file (VB/26000)
//SYSIN DD *
OPTION COPY,VLSCMP
INCLUDE COND=(37,25963,SS,EQ,TARG1)
/*
|
|
|
Back to top |
|
|
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
Thanks Frank but this may not work for me as there are lot of dates in the record. Also I gave DATE as an example, I may be required to check for a value in FIELD1 which may be a COMP or some other data in FIELD2 which may be a COMP-3 field.
Basically I need a method to check data in all occurences of a given field / field(s) for each record.
I don't think I found anything in SORT which I could use, so I was thinking maybe ICETOOL had some option for checking data in all occurences.
As these are ADHOC type of requirements, we would be able to sacrifice a bit on performance if there is any method to perform such operations thru SORT / ICETOOL quickly.
Again, thanks for all your help!!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm not really sure what you mean. DFSORT's substring logic function checks byte by byte for a string and includes the record if you get a hit. If that doesn't work for you, then I don't have anything else to suggest based on what you've said. You might be able to do something with IFTHEN clauses and OUTFIL INCLUDE, but it would probably be "messy". |
|
Back to top |
|
|
|