stream UDC - “read_jobcard” (cont)
… # concatenate continuation (&) lines while rht(setvar(!_str_arg1,rtrim(!_str_arg1)),1) = '&' do # remove & and read next input record setvar !_str_arg1 lft(!_str_arg1,len(!_str_arg1)-1)+ltrim(rht(input(), -2)) if _str_numbered then setvar !_str_arg1 lft(!_str_arg1,len(!_str_arg1)-8 endif endwhile # remove passwords, if any while setvar(_str_pos,pos('/',!_str_arg1)) > 0 do setvar !_str_arg1 repl(!_str_arg1,"/"+word(!_str_arg1,'.,;',,,_str_pos+1),"") endwhile # return, upshifted, all args right of "JOB", and strip all blanks. setvar !_str_arg1 ups(repl(xword(!_str_arg1)," ","")) return
Notes:
- If the JOB record is continued (ends with an ampersand) then the first WHILE loop above will read the remaining continuation lines.
- Each continuation line is appended to the return variable (arg1) after numbers and leading spaces (ltrim) are removed.
- !_str_arg1 is referenced, rather than simply “_str_arg1” since the contents of _str_arg1 is the name of a variable. For instance, in the STREAM UDC arg1 is passed as “_str_jobcard”. After calling the read_jobcard entry the main body of the UDC will test the value of _str_jobcard, looking for a JOBQ parameter. Using !_str_arg1 on the left side of a SETVAR is like using “_str_jobcard”.
- Next, any user, account and/or group passwords, if present, are removed (not blanked over). If a password is found (pos of “/” > 0) then the “/” and the password itself are replaced with “”.
- Finally, the concatenated, password filtered, de-numbered, de-blanked and upshifted JOB record is returned, via arg1, to the caller. The “:JOB “ portion is also removed by the xword function.