Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : @WRITEDSN

@WRITEDSN
Writes a record to the current file. (C)
Invocation
CALL @WRITEDSN(string)
 
The character string that is written as the next record. Its syntax can be C (fixed-length character string), V (variable-length character string), or W (double-byte character).
Usage Notes
@WRITEDSN accesses a z/OS file using the data set name. There is no provision for using a DDNAME with this tool instead of a data set name.
If the file specified in the @OPENDSN statement is a z/OS data set and it does not exist, @WRITEDSN fails. If the file is a Windows or Solaris file, it is created for you.
On non-z/OS platforms, when the data is written to the external file, it is subject to the type specification for the file as given in filespec.dsn or by the DSBIFTYPE Execution Environment parameter. If the file type is LENGTH_PREFIXED_EBCDIC, the data is left alone and written as EBCDIC. If the file type is LINE_SEPARATED_ASCII, the data is converted from EBCDIC to ASCII when written and back from ASCII to EBCDIC when read (using @READDSN).

Exception
 
Raised if you are attempting to output to a file that has not yet been specified by @OPENDSN, if the file cannot be opened, or if the length of the source record is bigger than the record length of the output file.
Example
The following rule opens an existing file, writes data from the example table to it, closes the file, reopens it, reads back the first record from it, and prints that record to the message log:

 
RULE EDITOR ===> SCROLL: P
WRITEDSN_1;
_ LOCAL RECORD;
 _ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ CALL @OPENDSN(TSOID || '.EXAMPLES.DATA'); | 1
_ FORALL EMPLOYEE: | 2
_ CALL @WRITEDSN(EMPLOYEE.LNAME); |
_ END; |
_ CALL @CLOSEDSN; | 3
_ CALL @OPENDSN(TSOID || '.EXAMPLES.DATA'); | 4
_ RECORD = @READDSN; | 5
_ CALL MSGLOG(RECORD); | 6
_ CALL @CLOSEDSN; | 7
_ ---------------------------------------------------------------------------

 
Resulting Output
Pressing PF2 after executing this rule displays the following output:

 
------------------------ INFORMATIONAL MESSAGE LOG ------------------------
COMMAND ===> SCROLL ===> P
SMYTHE

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved