/* */
trace 'o'

parse arg dsn

if dsn <> '' then do                            /* dsn specified            */
  parse value dsn with '<'server'>'filename     /* get the server           */
  if server = '' then do
    filename = dsn                              /* fixup filename           */
    'extract name'                              /* get name of current file */
    parse value name with '<'server'>'.         /* find server from it      */
  end

  if server <> '' then do                       /* got a server now         */
    'HOSTCMD' server 'SUBMIT' "'"filename"'"    /* submit job               */
  end
end
else do                                         /* no dsn specified         */
  'extract name'                                /* get current file name    */

  parse value name with '<'server'>'hlq'.'filename   /* get high level qual */

  tempdsn = hlq||'.$CODEJCL'||'.D$'||date('B')||'.T$'||time('S') /* bld dsn */

  'HOSTCMD' server 'alloc dsn('"'"tempdsn"'"') space(10 2) tracks recfm(f b)',
                   'lrecl(80) blksize(6400) dsorg(ps) reuse'   /* alloc dsn */

  'SAVETO <'server'>'tempdsn                    /* save curr file contents  */

  'HOSTCMD' server 'SUBMIT' "'"tempdsn"'"       /* submit job               */

  'HOSTCMD' server 'delete' "'"tempdsn"'"       /* delete dsn               */
end
