Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems reade on a logical 1

Status
Not open for further replies.

TracyV

Programmer
Nov 24, 2003
35
US
In a query I can display five records equal to the key I am using within my program, but when I reade within my program, I am only accessing three records. It's like it's reading every other record. Any ideas??
 
No, they are not deleted records. If they were, would they even show up in the query?
 
Take a look at the source listing of the logical file. There must be something there that limits the selection.

Query between physical and logical does not always mean same
result.
 
so how do you know the reade,,, only gives you 3 records, is it thru a display file, or report or what?? I ask deleted records, because old S36 Files/programs do not necessarily actually remove the record,, they just mark it in some way ,, so the following programs knows,, it had been deleted.. as a "D",, in column 1, etc, etc. just trying to cover all the bases.
 
I checked the file description. There are no deleted records in the file. I ran both the query and the program over the same logical. I've checked to make sure there are no other files with the same name. I know it reads three records, because I put the program into debug and only three records were read before leaving the loop.
 
Are you sure ran both in same logical file? Did you qualify your query with the library name? How about using STRSQL and do a plain select statement. Did you look at the source definition of the logical file? and can you publish it here?
 
The system I am working on does not have SQL. the logical COHSTTL5 is the ONLY object on their system by that name, so I know the query and program are using the same file.
Below is the logical. Nothing unusual about it.

5722SS1 V5R2M0 020719 Data Description TLVLIB
File name . . . . . . . . . . . . . . . . . . . . . : COHSTTL5
Library name . . . . . . . . . . . . . . . . . . : TLVLIB
File attribute . . . . . . . . . . . . . . . . . . : Logical
Source file containing DDS . . . . . . . . . . . . : QDDSSRC
Library name . . . . . . . . . . . . . . . . . . : TLVLIB
Source member containing DDS . . . . . . . . . . . : COHSTTL5
Source member last changed . . . . . . . . . . . . : 06/16/05 14:45:16
Source listing options . . . . . . . . . . . . . . : *SOURCE *LIST
DDS generation severity level . . . . . . . . . . . : 20
DDS flagging severity level . . . . . . . . . . . . : 00
File type . . . . . . . . . . . . . . . . . . . . . : *DATA
Authority . . . . . . . . . . . . . . . . . . . . . : *LIBCRTAUT
Replace file . . . . . . . . . . . . . . . . . . . : *NO
Text . . . . . . . . . . . . . . . . . . . . . . . : Payment History Tax
Compiler . . . . . . . . . . . . . . . . . . . . . : IBM AS/400 Data Descr
A R COHSTT5
A PFILE(COHSTT)
A TRDATE R
A TRTIME R
A STRAN# R
A TRSEQ# R
A TOTLPD R
A SPECPD R
A SPECPI R
A TAXPI R
A ADFEE R
A TWNSHP R
A RSECTN R
A RRANGE R
A RSUBD R
A RBLOCK R
A RPAR# R
A TAXYR R
A TXRPT# R
A PONAME R
A TRMD I SST(TRDATE 1 4)
A TRCY I SST(TRDATE 5
A K TWNSHP
A K RSECTN
A K RRANGE
A K RSUBD
A K RBLOCK
A K RPAR#
A K TAXYR

Total Informational Warning Error Severe
(0-9) (10-19) (20-29) (30-99)
0 0 0 0 0
 
IN your debug,, do you display the key field,, maybe,, you are assuming something,, that while you think is correct,,, does not pan out like you want it??
 
I put a break directly after the read statement. I've done a step thru numerous times. Only three records are read. What's strange is it's every other record of the five records! I'll follow thru with your SQL suggestion and move the file to our system and try that.
 
Can you do the following in the AS400 command line?

DSPFD FILE(Libname/File) for both the physical and logical file. Go to the end screen(bottom) and it should
tell you how many records.

If the records are the same then are you using a dumb terminal or PC emulation to AS400? If PC emulation then
what product are you using. How do you run your queries?

This brings an old issues where I have to install a patch in both the host and PC emulator because of certain bug when doing queries
 
Can you also publish here the RPG program? Only the statement where the READE operation was used and the key structures of the search key. There might be some differences with the search key structure vs file format.
 
Some things to check for

1. KList is setup correctly
2. Alpha vs numeric in key fields
3. Another read somewhere in the pgm
4. Shared OPD with another pgm

Since you seem to get every other, I suspect "3" is most likely.
 
you could also isolate these 5 records. Do a read regular, then a READE, see if there is any change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top