165 pts.
 READC on load all AS/400 subfile
I have a load all subfile.  Data is entered in a select field, F1 is hit, I go into a routine to READ the Changes on the subfile.  The READC indicator comes on for the first read, thus leaving the routine.  Why?

    238       C* READ THE SUBFILE CHANGES                                          239       C     SrReadC       BEGSR                                            240       C                   DOU       *in40                                  241       C                   READC     SFLRCD                                 242       C                   IF        *in40                                  243       C                   leave                                            244       C                   ENDIF                                            245        *                                                                   246       C                   Movel     horder        KCPORD#                  247       C                   Eval      KCPSEQ# =  10                          248       C     kcompf        Chain     CUSTCOMPF                              249       C                   IF        not %FOUND(custcompf)                  250       C                   movel     horder        CPORD#                   251       C                   EVAL      CPSEQ# = cpseq# + 10                   252       C                   EVAL      CPCOMM = @comment                                                                                          More...  Debug . . .                                                                                                                                                   F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable     F12=Resume       F17=Watch variable   F18=Work with watch   F24=More keys      *IN40 = '1'                                                                  



Software/Hardware used:
as400, RPG
ASKED: October 18, 2010  9:41 PM
UPDATED: October 25, 2010  2:51 PM

Answer Wiki:
Maybe you didn't copy it or paste it correctly but I don't see how *IN40 is associated with the READC. In the control record is F1, CA01 or CF01??? Phil
Last Wiki Answer Submitted:  October 19, 2010  12:33 am  by  philpl1jb   44,180 pts.
All Answer Wiki Contributors:  philpl1jb   44,180 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

There is no way to know the answer from what you have shown us. As Phil noted, we have no clue what *IN40 is. It might be set on or off by any statement elsewhere in the program.

I’m not at all clear why you would use an indicator at that point anyway — you should be using the %EOF() builtin function, assuming that you want to know when you’ve reached the end of changed records.

The only answer that comes to mind is “If you don’t want *IN40 on at that point, then don’t set it on.”

Tom

 108,085 pts.

 

This is a guess, but it looks like *in40 is an EOF or ERR indicator for SFLRCD. You’d be better off adding the (E) extender to the ReadC operation and using If %EOF(display file name) or %Error instead of If *in40.

 5,670 pts.

 

Yeah, it looks bad. Two issues here: 1. The difference between CA and CF. solved. 2. *in40 is the indicator on the readC, – solved.

Does anyone have the positions for the highest RRN on a Subfile? This was found in the old CPF programmer’s guide a hundred years ago. It was right after the Lowest RRN currently displayed on the subfile. This info comes from the INFDS.

 165 pts.

 

Does anyone have the positions for the highest RRN on a Subfile?

Positions? You mean in the INFDS? Should be a 2-byte binary (integer) number at offset 13, positions 14-15. It’s the total number of rows in all active subfiles.

Tom

 108,085 pts.

 

Nickhutcheson, if you can’t change that CA key to CF, an alternative to ReadC is to chain to the subfile.

 5,670 pts.