FILE ACCESS UTILITY Release Level 1.0 This application consists of one runfile: PAG.Run Product Name : File Access Utility Supported On : B24, B26, B27, B28, B38, B39, and all SuperGen hardware Supported OS : BTOS II, CTOS I, CTOS II, CTOS III Description : The current implementation of Batch does not directly allow JCL files to access and use the contents of text files. The File Access utility and accompanying source module (in CTOS Pascal) demonstrate a method of accessing text file contents. Directions/Use : The File Access utility may be enhanced to make use of additional CTOS.lib string calls; for example, LookUpString and LookUpNumber. The following instructions detail use of the File Access Utility: Execution of the utility with a command case of '00' will place a string into a file. Command case '01' extracts the string from a file, places the string into the ASCB ExitString field and allows Batch access to the string with its ErcMsg variable. The application executed with a command case '00' accepts up to two parameters. The first being the string, the second being a file name to which the string will be written. The second parameter is optional, with a default value of '[Scr]<$000>MsgFile.tmp'. The application executed with a command case '01' accepts one optional parameter, the filename of the file containing the string to access, again the default being '[Scr]<$000>MsgFile.tmp'. NOTES: As the CTOS.lib function RgParam subparameters are sbstrings, the length of any string being passed to the PAG.run is 255 characters. Reading of a string using case '01' is currently set to a limit of 1024 characters. Currently, Batch places a linefeed at the end of the ErcMsg string. This linefeed will be removed in a future release of Batch. Therefore, the JCL programmer must place a check for the linefeed in the JCL (as shown in the sample JCL file) and then remove the linefeed only if it is present. Error checking within this application is limited since the implementation is intended for use by programmers. Also, it is important for the JCL programmer to copy the ErcMsg variable to a another variable since any application which uses the ErrorExitString call will write to the ASCB and ErcMsg will be overwritten with the new contents of the ExitString field in the ASCB. A sample JCL is provided to demonstrate using the utility. SAMPLE JCL JOB Test VarA = 'This is a test string' Run ([sys]PutStr.run,, '00'), VarA, & [Sys]StrTemp.fl Run ([Sys]PutStr.run,, '01'), & [Sys]StrTemp.fl VarB = ErcMsg StrLen = stringlength(VarB) StrEnd = SubString('\\0Ah', VarB) If (StrEnd NE 65535) StrLen = StrLen - 1 EndIf VarB = CopyString(VarB, 0, StrLen) DisplayLine('The String is: ', VarB) END