635 pts.
 Error in subfile programming
I am encountering a very annoying problem. I have a subfile program and i am writing both SFL and SFLCTL and then reading the subfile. But as soon as the my code read the subfile READ D123, it gives me an error saying "Session or device error occurred in file D123" and then in DUMP it says Message Identifier . . . . . . . . . . :   CPF5053              A record name is required.           Anybody with the solution. Thanks

Software/Hardware used:
os/400
ASKED: February 9, 2011  5:19 PM
UPDATED: February 10, 2011  11:04 PM

Answer Wiki:
I would compare the code in this program with another one of yours that has a working subfile. The main things I would compare are: o What is the sequnece of my WRITE, READ, READC, EXFMT instrucitons o What indicators are on/off when these are happing. Sometimes I copy an the source form an old DSPF and use it with code I copied from a newer RPG program and I have problems. The "Standards" changed over time as to what indicatiors I use in the DSPF for conditioning the SFLxxx keywords.
Last Wiki Answer Submitted:  February 9, 2011  5:25 pm  by  CharlieBrowne   32,905 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,905 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

…read the subfile READ D123, it gives me an error saying “Session or device error occurred in file D123

According to what you wrote, you are issuing your READ statement against the file — D123.

The error message is CPF5053 which means “A record name is required.”

You need to READ the subfile record name instead of the file name. You can’t READ D123.

Tom

 108,155 pts.

 

but when i gove subfile record name (RECSFL) it gives me an error ”

e READ Operation entry is invalid for the Subfile-Record format. Specification ignored

 635 pts.

 

DDS is as follows:-

A DSPSIZ(24 80 *DS3)
A R RECSFL SFL
A 30 SFLNXTCHG
A UPC 20 B 8 3TEXT(‘UPC 2ND ITEM’
A 31 DSPATR(UL)
A*
A R RECCTL SFLCTL(RECSFL)
A*
A SFLSIZ(0010)
A SFLPAG(0005)
A 10 SFLDSP
A 10 SFLDSPCTL
A N10 SFLCLR
A SFLDROP(CF04)
A SFLFOLD(CF04)
A 5 3′UPC SHORT CODE. .’
A COLOR(WHT)
A UPCSCD 3A I 5 24TEXT(‘UPC’)

RPG

FD123 CF E WORKSTN INFDS(@D123)
F SFILE(RECSFL:I1)

C READ RECCTL

C *ENTRY PLIST
C PARM PADDNO 8
*
C S999 BEGSR
*
C SETOFF 3110
C Z-ADD 0 I1 4 0
C Z-ADD 5 PG 4 0
*
C WRITE RECCTL
C DO PG
C ADD 1 I1
C WRITE RECSFL
C ENDDO
C SETON 1031
C MOVEL ’111′ UPCSCD
C ENDSR

 635 pts.

 

Is that the entire RPG program or only pieces of it? It looks like the only thing the program does is attempt to read the RECCTL control record. The subroutine that generates the subfile rows is not executed anywhere that I can see.

Tom

 108,155 pts.

 

…READ Operation entry is invalid for the Subfile-Record…

Yes, that’s exactly correct. The actual input operation code should be either a CHAIN by relative record number or READC to get the next changed subfile record.

But note that neither op-code can actually run until after the subfile is built.

Tom

 108,155 pts.

 

Just Update record in physical file and try

 300 pts.