MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

differance between diskr and diskw

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Thu Sep 30, 2004 7:27 am    Post subject: differance between diskr and diskw Reply with quote

OK... I am confused...

Below is a roiutine I am to fix to print a report.....
Code:

ARG GSTACNT, PRDSTRT, PRDEND, LINE114, LINE115, lnum, batchid,first     
                                                                       
TEMP = GSTACNT PRDSTRT PRDEND LINE114 LINE115 lnum batchID first       
                                                                       
PARSE VAR TEMP ACNT PSTRT PEND L114 L115 LNum batch first               
                                                                       
/* Column headings for the report */                                   
                                                                       
COL1 = "GST_ACNT_NBR   "                                               
COL2 = "PRD_STRT_DT    "                                               
COL3 = "PRD_END_DT     "                                               
COL4 = "LINE 114       "                                               
COL5 = "LINE 115       "                                               
                                                                       
HEADING = COL1||COL2||COL3||COL4||COL5                                 
                                                                       
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.

Much thanks in advance.
Back to top
View user's profile Send private message
sriramla
Beginner


Joined: 22 Feb 2003
Posts: 74
Topics: 1

PostPosted: Thu Sep 30, 2004 9:58 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Thu Sep 30, 2004 12:40 pm    Post subject: RE..... Reply with quote

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 ?
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Sep 30, 2004 12:56 pm    Post subject: Reply with quote

What is the value for "lnum" when the EXECIO statement is executed? It needs to be a numeric value > 0.
Back to top
View user's profile Send private message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Thu Sep 30, 2004 1:31 pm    Post subject: Reply with 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 ).
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Thu Sep 30, 2004 2:50 pm    Post subject: Reply with quote

Try getting rid of the DISKR in the TITLE section (they don't do anything) then set lnum to 1 when you call the routine.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Sep 30, 2004 3:07 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Sep 30, 2004 3:57 pm    Post subject: Reply with quote

Agreed.

Get rid of the two DISKR statements, as they don't do anything relevant.

Then, add the statement:

"EXECIO * diskr output (stem Detail. finis"

to initialize the stem variable Detail. for the occurences of Detail.1, Detail.2, and Detail.3.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group