× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 7/28/2016 8:57 PM, CRPence wrote:

After invoking the program as loaded\run by the OCL, my output file
S36OUT has a blank record, followed by the expected record. Statement
trace seems to show the write at '.DRVFW02' occurring twice, but I have
almost no idea why, though possibly something to do with non-detail
record output -- I am really quite RPGII illiterate.

Although exhibited by an RPG II program, this is a feature of the RPG
cycle in all dialects. Refer to the detailed RPG cycle here:
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/pgmcycdtl.htm
Specifically, look at step 4 *DETL (Perform heading and detail output).
Note that it occurs before step 5 (*GETIN).

In particular, understand that indicator 1P is on at this moment in
time, and the point of this 'pre-read' part of the cycle is to put
static information (like headings) on a printed report. Following the
cycle diagram:

1: Setoff RT
2: First time YES
3: *INIT, open files
4: *DETL, perform detail output.
OADD is not conditioned, so an output operation is performed.
The field being output is conditioned on LR.
LR is not on, so the field is not put into the I/O buffer, leaving
the I/O buffer empty.
5: *GETIN
6 - 8: Test various exit conditions
9: Test LR - LR is OFF, so go to 11
11: Test RT - RT is OFF so go to 14
14: Primary file YES
15: Retrieve a record
16: End of file NO
17: Assert record sequence
18: Sequence error NO
20: FORCE NO go to 22
22: Match fields NO go to 24
24: Should LR be set on NO go to 26
26: SETON record ID
27: Control break NO go to 29
29: Totals? NO go to 32
32: LR OFF go to 41
41: Overflow OFF
43: Set MR
44: Make data available from last record read
At this point, RCDINP is populated
45: Look-ahead NO
47: *DETC perform detail calculations
At this point, RCDINP is moved to RCDOUT and LR is set ON
go to 4
4: *DETL, perform detail output.
OADD is not conditioned, so an output operation is performed.
The field being output is conditioned on LR.
LR is on, so the field is put into the I/O buffer
5: *GETIN
6 - 8: Test various exit conditions
9: Test LR - LR is ON go to 10
10: Set L1-L9 go to 29
29: Totals? YES
30: *TOTC perform total calculations (none present)
31: *TOTL perform total output (none present)
32: LR is ON go to 33
33: Halt indicators NO go to 34
34: LR ON go to 35
35: *TERM
36: *CANCL
37: Halt indicators NO
38: Factor 2 to PARM
39: Set return code
40: Return to caller

Step 4 (Perform detail output) is executed twice. The first time,
before the first record is read, and the second time, after. The
classic pattern is to use a record identifying indicator on the I specs
and use the same indicator to condition the output operation, so these
would be the changed lines.

IS36INP XX 01
OS36OUT DADD 01
O RCDOUT 55


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.