in reply to Ideal way to pass a file to a module

Probably you want to pass the name of the file, because your routine will have to rebuild it with ASA controls pre-pended to each line. Something like this pseudo-code:
add_asa_ctl_char { file = shift; open file; # I said it was pseudo-code! open temp_file; while <read file} { write temp_file asa_ctl+input_line } close(file, temp_file) return(temp_file) }
In your calling module you decide whether you want to replace the original file with the temp-file, or not. (How lucky do you feel?) You may also have to take into consideration the difference between fixed and variable length records in your module. That determines where in your output string the asa-ctl char physically goes. (Before the data, of course, but where in the input string does the data start -- is there a rcw or a srcw you have to account for and adjust?)

The real question is: what are you going to use for the asa-ctl character? I'd not suggest '1'.....

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re: Re: Ideal way to pass a file to a module
by pboin (Deacon) on Apr 12, 2004 at 20:02 UTC
    The real question is: what are you going to use for the asa-ctl character? I'd not suggest '1'.....

    Hmm... Why not I wonder?

    I've got a bunch of reports coming out of a NT box that will eventually be FTP'd to MVS VBA datasets and re-archived on the 'frame.

    What I'm looking at now 'cause I don't know w/ 100% certainty that all files have (or don't have) ASA CC is this:

    Scan the file top to bottom, looking for /^[0-9ABCVW-+\x5A]/. If that's all I find, and I find at least one '1' per 100 lines, then for our purposes it *has* ASA CC and should be left alone. If I find any illegal byte in the first column, or if there aren't enough top-of-pages, the file needs to have ASA control inserted.

    The insertion will be as simple as possible, basically, space pre-pended to every line except those lines with \x0C., which is DOS FormFeed. In that case, delete the \xOC and use a '1' in the first position.

    Thanks for your time in responding, especially with the MVS side of the house -- tough combination to find w/ Perl.