View previous topic :: View next topic |
Author |
Message |
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Thu Feb 05, 2004 5:30 pm Post subject: |
|
|
SK,
Did you mean the following ?
EVALUATE END-OF-A ALSO END-OF-B
WHEN FALSE ALSO FALSE
EVALUATE TRUE
WHEN N-AID = O-AID
PERFORM 1200-UPDATE
PERFORM 0500-NEW-READ
PERFORM 0800-OLD-READ
WHEN N-AID > O-AID
PERFORM 1500-XYZ
PERFORM 0500-NEW-READ
WHEN N-AID < O-AID
PERFORM 1600-PQR
PERFORM 0800-OLD-READ
END-EVALUATE.
END-EVALUATE
If yes, looks like a nested evaluate stmt and doesnt make any clear logical meaning as to what exactly you are trying to do Remember if your code compiles it does not necessarily mean that it is logically correct.
If your records are not being read to the EOF ..it could mean that your READ statement is being executed only once instead of being performed in a loop until EOF.
If that doesnt help ..I guess you will have to Post the relevant piece(s) of code.
vini |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Thu Feb 05, 2004 8:11 pm Post subject: |
|
|
Hi,
I want to compare two files and using nested EVALUATE for the same purpose. I intend to compare id column of the 1st record in the first file with the id's in all the records in second file, if a match is found I compare the entire record.
Can I use one EVALUATE block inside another EVALUATE as written in the above code piece.
Thx. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 9:27 am Post subject: |
|
|
Hi Kolusu,
Thanks for your help. I have a query here. Are you taking the input files as they are, I mean without sorting them and comparing their keys. So will go like first record from the first file compared with first record from the second file, second record with the second and like that...
I tried using SORT n my JCL, but I think its not generating correct results, since I am sorting on the column which has a system generated value and contains characters like '-'. Does sort work only on numeric or character columns. If not then what is the correct way of sorting the above mentioned columns. Right now I have my sort card as follows:
SORT FIELDS=(1,15,CH,A)
Could you provide information on this.
Thax. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Fri Feb 06, 2004 9:57 am Post subject: |
|
|
Sk,
The solutions posted in the match topic are all based on the fact that both files are sorted on the key fields prior to running the program.
Quote: |
I tried using SORT n my JCL, but I think its not generating correct results, since I am sorting on the column which has a system generated value and contains characters like '-'. Does sort work only on numeric or character columns. If not then what is the correct way of sorting the above mentioned columns. Right now I have my sort card as follows:
|
Is your key a date field? If it is date field then sorting asc will not provide the correct results. why don't you provide sample input data and desired output ?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 10:11 am Post subject: |
|
|
Hi Kolusu,
The column is a row_id column having values like
0-R9NH
B-111
Z-2BD
1-APXC
N-31L4
So after sorting
B-111
Z-2BD
N-31L4
1-APXC
0-R9NH
According to me, if its sorting based on the character then value starting with 'N' should come before 'Z'.
Please let me know whether this is correct.
Thanx. |
|
Back to top |
|
 |
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Fri Feb 06, 2004 10:36 am Post subject: |
|
|
Standard character sort values should always put a 'N' before a 'Z'. However, if 'N' was upper case and 'Z' was lower case, the 'Z' *would* come before 'N' in the EBCDIC sequence. Could this be the problem? Also, although it's uncommon these days, some printer and some screens are set up to display lower case as upper case (folding). So check the hex values just in case. |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 10:42 am Post subject: |
|
|
Hi,
Thanks for the info, but all the letters are uppercase and that is what is amazing me. So I felt that SORT is not working properly for this column since it contains '-' character.
Thanx. |
|
Back to top |
|
 |
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Fri Feb 06, 2004 10:48 am Post subject: |
|
|
The '-' in later characters should not prevent the first characters being in order. '-' is just another character anyhow.
OK, how about this: are you using variable length records? If so you may need to add 4 to your sort start position otherwise I think you might be sorting on the RDW (record length) which could give weird results. If not, you could post the whole sort JCL and all inputs and outputs including sort messages for us to look at. |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 10:57 am Post subject: |
|
|
I am not using variable length records. What is RDW?
I have a sort card which has only one statement like this.
SORT FIELDS=(1,15,CH,A)
I am calling this sort card in my JCL to sort the file based in the column row_id.
Thanx. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Fri Feb 06, 2004 11:08 am Post subject: |
|
|
Sk,
using a regular sort I was getting the following sequence
Code: |
B-111
N-31L4
Z-2BD
0-R9NH
1-APXC
|
This is the JCL being used
Code: |
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0-R9NH
B-111
Z-2BD
1-APXC
N-31L4
//SORTOUT DD SYSOUT=*
SORT FIELDS=(1,15,CH,A)
|
Can you post your 3.4 listing for the file containing that data. As mike guessed your input file may be a variable block file. A varible block file has a fixed part and a variable part. The first 4 bytes is the RDW(Record Descriptor Word) which is Data preceding a variable record that specifies the length of the entire record including the RDW.
Ex:
Code: |
RDW|aaaaaaaaaaa|bbbbbbbbbbbbbbbbbbbbbb
RDW|ccccccccccc|
RDW|fffffffffff|vvvvvvv
|
And there are V,F,FB,VB & U record formats.
V - variable file
F - Fixed
FB - Fixed block file
VB - variable block file
U - Undefined file format
Check the following links for detailed explanation of the various recfm
Fixed-Length Records (Format F)
Variable-Length Records (Format V or D)
Undefined Records (Format U)
Spanned Records (Format S)
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 11:33 am Post subject: |
|
|
Hi,
I guess you wanted the data from the file. This column is the first one in the file and has values as follows:
When I see the file attributes it is FB having a block size.
..0-R9NH
..1-94PN
..B-111
Thanx. |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 12:15 pm Post subject: |
|
|
Hi Kolusu,
I have code similar to what you have in the example(link you have given in your earlier reply), but still it is failing with the same error. i.e. reading after the end of file has occured.
I am not able to understand as to what is going wrong here. I had the same code working 2 days back. Could you please let me know why it is happening.
Does a file have some EOF character to identify that file has ended. I have code like this for reading the file.
0500-NEW-READ.
READ A-FILE INTO A-FILE-REC-WS
AT END
MOVE 'Y' TO S-IN-A-FILE
MOVE HIGH-VALUES TO A-ROW-ID * first field in my file
DISPLAY 'NEW FILE HAS ENDED'
NOT AT END
ADD 1 TO NEW-READ-CTR * a read counter
END-READ. |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 12:59 pm Post subject: |
|
|
Since the code was causing error I tried using the EVALUATE clause before the EVALUATE in the PROCESS which actually compares the keys from two files.
Could you please let me know as to how can i correct this problem.
Thanx. |
|
Back to top |
|
 |
SK Beginner
Joined: 04 Feb 2004 Posts: 26 Topics: 3
|
Posted: Fri Feb 06, 2004 1:56 pm Post subject: |
|
|
Hi Kolusu,
Are you there to reply my code queries. |
|
Back to top |
|
 |
|
|