DollarSymbol = '$' /* Used in formatting dollar amounts */
DecimalSymbol = '.' /* Used in formatting dollar amounts */
/* This first IF block determines if this is the first time that */
/* the file is written to. If it is then write out the report title */
/* and column headings. */
IF FIRST = 'Y' THEN DO
J = 1
TITLEPAD = " "
TITLE.J = TITLEPAD||"GST RETURNS (DOC ONLY) PROCESSED"
"EXECIO * diskr output (stem TITLE. finis"
J=J+1
TITLE.J = "BATCH ID = "batchID
"EXECIO * diskr output (stem TITLE. finis"
J=J+1
TITLE.J = HEADING
"EXECIO * diskw output (stem TITLE. finis"
END
/* The next 3 lines format the GST_ACNT_NBR, PRD_STRT_DT and */
/* PRD_END_DT to be left justified and padded to 15 characters */
Account = LEFT(ACNT,15)
startdt = LEFT(PSTRT,15)
enddt = LEFT(PEND,15)
/* This next block will: *
/* 1 - Determine the length of each money amount field. *
/* 2 - Insert a decimal point to indicate that the last two digits *
/* are cents. *
/* 3 - Put the dollar sign at the front of the money field. *
/* 4 - Left justify and pad the field to a max of characters. *
IF l114 <> "###########" THEN
DO
A = LENGTH(L114)
A1 = INSERT(DecimalSymbol,L114,A-2)
A2 = DollarSymbol||A1
A3 = LEFT(A2,15)
END
ELSE
A3 = "-----------"
IF l115 <> "###########" THEN
DO
B = LENGTH(L115)
B1 = INSERT(DecimalSymbol,L115,B-2)
B2 = DollarSymbol||B1
B3 = LEFT(B2,15)
END
ELSE
B3 = "-----------"
Detail.lnum = account||startdt||enddt||A3||B3
say detail.lnum
"EXECIO * diskw output (stem Detail. finis"
The problem is that the last diskw command does not write anything to the report in question BUT what I find even stranger is that the first two diskr comands do write to the report.
My understanding is that DISKR reads from a file and DISKW writes to the file.... Is this correct ?
Can anyone tell me why the last command does not actually write anything to the file. Note that the SAY command on the second last line shows me that data actually is available to be written.
DISKR for reading and DISKW for writing. No confusion.
To understand what happens during execution, use 'trace' command with 'R?' option in the beginning of the program. This should tell you what is the program flow, how many times DISKR is executed, DISKW is executed etc.
Posted: Thu Sep 30, 2004 12:40 pm Post subject: RE.....
I used the TRACE ?R command but it did not tell me anything. All the values that I was expecting were correct ... It simply is not written to the file.
Can trace be used to look at what EXECIO is doing internally ?
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Thu Sep 30, 2004 3:07 pm Post subject:
The DISKR is not doing the writing. You have a DISKW after the DISKR that is doing the write.
I think, the problem is with the DISKW *.
Here is an excerpt from the manual (slightly reformatted for better readability):
Quote:
lines
the number of lines to be written. This operand can be a specific decimal
number or an arbitrary number indicated by *. If you specify a value of zero (0), no I/O operations are performed unless you also specify either OPEN, FINIS, or both OPEN and FINIS.
If you specify OPEN and the data set is closed, EXECIO opens the data set
but does not write any lines. If you specify OPEN and the data set is open,
EXECIO does not write any lines.
If you specify FINIS and the data set is open, EXECIO does not write any
lines, but EXECIO closes the data set. If you specify FINIS and the data set is not already opened, EXECIO does not open the data set and then close it.
If you specify both OPEN and FINIS, EXECIO processes the OPEN first as
described above. EXECIO then processes the FINIS as described above.
When EXECIO writes an arbitrary number of lines from the data stack, it stops only when it reaches a null line. If there is no null line on the data stack in an interactive TSO/E address space, EXECIO waits for input from the terminal and stops only when it receives a null line. See note below.
When EXECIO writes an arbitrary number of lines from a list of compound
variables, it stops when it reaches a null value or an uninitialized variable (one that displays its own name).
The 0th variable has no effect on controlling the number of lines written from variables.
Note: EXECIO running in TSO/E background or in a non-TSO/E address space has the same use of the data stack as an exec that runs in the TSO/E foreground. If an EXECIO * DISKW ... command is executing in the
background or in a non-TSO/E address space and the data stack becomes empty before a null line is found (which would terminate EXECIO), EXECIO goes to the input stream as defined by the INDD field in the module name table (see page 352). The system default is SYSTSIN. When end-of-file is reached, EXECIO ends.
Are you sure your DETAIL.1 has value?
Also, you say that,
Quote:
lnum is passed to this function and to start it equals 4 ( the data that the DISKW is to write starts at line 4 ).
When lnum is 4, you made the 4th record of DETAIL as the concatenated string. Unless, a number is specified in DISKW, you would be writing all the records in DETAIL; not just 4th record onwards. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum