FTP to Mainframe JES2 
Author Message
 FTP to Mainframe JES2

Just in case you haven't already coded this up, here is a way to ftp
to the JES input reader from OS/2 REXX: (look for <> pairs where you
need to do something)  I am sure the code could be cleaned up some and
I would be glad to see any suggestions.

============== cut for jes2.cmd ===================
/* Submit a file to JES2 on <our> MVS box via ftp */
cod = 0

/* first get the name of the file the user wants to send to JES2  and
make some validity checks */
parse arg localFile User Pass
 If localFile = '' | localFile = '?' then
   do
     say 'Usage: JES2 filename [User [Password]]'
     say '    - where filename is in the current directory or fully
qualified'
     say '    - User and password are optional and will default to
<ours> if both are omitted.'
     say ' (Note: Password alone may be omitted to prevent showing it
on the screen and'
     say '   the user will be prompted for it.'
     exit  16
   end

if User = '' & Pass = '' then
   do
      User = '<ouruser>'; Pass='<ourpass>'
   end /* do */
if User \= '' & Pass = '' then
   do
     rc = charout(,'Password: ')
     Pass = getk()  /* see other .CMD below */
   end

/* Load basic REXX functions so we can see if the file named in the
parm exists and do other neat stuff  <see other .CMD below>*/
If LoadRexx() then
   exit  16

 rc = SysFileTree(localfile,filok,'F')
 if filok.0 = 0 then
   do
     say 'The file' localFile 'was not found.  Please check the syntax
of your JES2 command.'
     exit 16
   end

/* OK, now we prep the ftp environment <see other .CMD below> */
if LoadFtp() then
   exit 16

 rc = FtpSetUser('<ourhostname>',User,Pass)
 rc = FtpSite('filetype=jes')

/* get the existing jobs for the logged on user, so we can tell which
one we are adding */
 rc = FtpDir('*',"jobsb.")
 do i = 1 to jobsb.0
    jobsb.i = strip(jobsb.i)
    if jobsb.i = 'No jobs found on Held queue' then
       say jobsb.i 'for' User
     else
       say jobsb.i 'exists on JES queue'
 end /* do */

/* and try to put the file that the user named */
 rc = FtpPut(localFile,localFile,'ASCII')
/* See if we can verify that it went properly */
 if rc \= 0 then
  do
   say 'FTP indicates a failure.' FTPERRNO 'Check the MVS console for
additional data.'
   cod = 12
  end

/* and see if we can get the new list */
 rc = FtpDir('*',"jobsa.")
 do i = 1 to jobsa.0
   jobsa.i = strip(jobsa.i)
 end /* do */

/* OK, compare the two lists and report */
 do i = 1 to jobsb.0
   do j = 1 to jobsa.0
      if jobsa.j = 'No jobs found on Held queue' then
         do
            jobsa.j = localFile
            leave
         end
      if jobsb.i = jobsa.j then
         do
            jobsa.j = ''
            leave
         end /* do */
   end /* do */
 end /* do */
 do i = 1 to jobsa.0
   if jobsa.i \= '' then
      say jobsa.i 'has been submitted'
 end /* do */

/* OK, clean up and bail out */
 rc = FtpLogoff()
 rc = FtpDropFuncs()
/* After exiting all the command shells, the FTP DLL will be released
by OS/2 */
exit cod
=============== end cut=============

===============cut for loadrexx.cmd ===========
/* Test and-or load RexxUtil */
/*LoadRexx*/
IF RxFuncQuery('SysLoadFuncs') THEN
    DO
        If RxFuncAdd('SysLoadFuncs','RexxUtil','SysLoadFuncs') Then
            DO
            SAY "Could not load RexxUtil"
            RETURN 1
            end
        CALL SysLoadFuncs
        END
RETURN 0
=============== end cut ============

============ cut for loadftp.cmd =============
/* Test and-or load FTP RexxUtil */
IF RxFuncQuery('FtpLoadFuncs') THEN
    DO
        If RxFuncAdd("FtpLoadFuncs","rxFtp","FtpLoadFuncs") then
            DO
            SAY "Could not load FTP environment"
            RETURN 1
            end
        rc = FtpLoadfuncs()
        END
RETURN 0
============== end cut ==================

=========== cut for getk.cmd ===============
/* get a buffer, CR terminated without echoing to screen */
buf = ''; asc = 0
do until asc = 13
key = SysGetKey('noecho')
asc = c2d(key)
buf = buf || key
end
return buf
================ end cut  ===================

=Dwight=
X1=L, X2=L & the domain is phonetic



Mon, 05 Feb 2001 03:00:00 GMT  
 FTP to Mainframe JES2

Quote:

>Just in case you haven't already coded this up, here is a way to ftp
>to the JES input reader from OS/2 REXX: (look for <> pairs where you
>need to do something)  I am sure the code could be cleaned up some and
>I would be glad to see any suggestions.

>============== cut for jes2.cmd ===================
>/* Submit a file to JES2 on <our> MVS box via ftp */
>cod = 0

>/* first get the name of the file the user wants to send to JES2  and
>make some validity checks */
>parse arg localFile User Pass
> If localFile = '' | localFile = '?' then
>   do
>     say 'Usage: JES2 filename [User [Password]]'
>     say '    - where filename is in the current directory or fully
>qualified'
>     say '    - User and password are optional and will default to
><ours> if both are omitted.'
>     say ' (Note: Password alone may be omitted to prevent showing it
>on the screen and'
>     say '   the user will be prompted for it.'
>     exit  16
>   end

>if User = '' & Pass = '' then
>   do
>      User = '<ouruser>'; Pass='<ourpass>'
>   end /* do */
>if User \= '' & Pass = '' then
>   do
>     rc = charout(,'Password: ')
>     Pass = getk()  /* see other .CMD below */
>   end

>/* Load basic REXX functions so we can see if the file named in the
>parm exists and do other neat stuff  <see other .CMD below>*/
>If LoadRexx() then
>   exit  16

> rc = SysFileTree(localfile,filok,'F')
> if filok.0 = 0 then
>   do
>     say 'The file' localFile 'was not found.  Please check the syntax
>of your JES2 command.'
>     exit 16
>   end

>/* OK, now we prep the ftp environment <see other .CMD below> */
>if LoadFtp() then
>   exit 16

> rc = FtpSetUser('<ourhostname>',User,Pass)
> rc = FtpSite('filetype=jes')

>/* get the existing jobs for the logged on user, so we can tell which
>one we are adding */
> rc = FtpDir('*',"jobsb.")
> do i = 1 to jobsb.0
>    jobsb.i = strip(jobsb.i)
>    if jobsb.i = 'No jobs found on Held queue' then
>       say jobsb.i 'for' User
>     else
>       say jobsb.i 'exists on JES queue'
> end /* do */

>/* and try to put the file that the user named */
> rc = FtpPut(localFile,localFile,'ASCII')
>/* See if we can verify that it went properly */
> if rc \= 0 then
>  do
>   say 'FTP indicates a failure.' FTPERRNO 'Check the MVS console for
>additional data.'
>   cod = 12
>  end

>/* and see if we can get the new list */
> rc = FtpDir('*',"jobsa.")
> do i = 1 to jobsa.0
>   jobsa.i = strip(jobsa.i)
> end /* do */

>/* OK, compare the two lists and report */
> do i = 1 to jobsb.0
>   do j = 1 to jobsa.0
>      if jobsa.j = 'No jobs found on Held queue' then
>         do
>            jobsa.j = localFile
>            leave
>         end
>      if jobsb.i = jobsa.j then
>         do
>            jobsa.j = ''
>            leave
>         end /* do */
>   end /* do */
> end /* do */
> do i = 1 to jobsa.0
>   if jobsa.i \= '' then
>      say jobsa.i 'has been submitted'
> end /* do */

>/* OK, clean up and bail out */
> rc = FtpLogoff()
> rc = FtpDropFuncs()
>/* After exiting all the command shells, the FTP DLL will be released
>by OS/2 */
>exit cod
>=============== end cut=============

>===============cut for loadrexx.cmd ===========
>/* Test and-or load RexxUtil */
>/*LoadRexx*/
>IF RxFuncQuery('SysLoadFuncs') THEN
>    DO
>        If RxFuncAdd('SysLoadFuncs','RexxUtil','SysLoadFuncs') Then
>            DO
>            SAY "Could not load RexxUtil"
>            RETURN 1
>            end
>        CALL SysLoadFuncs
>        END
>RETURN 0
>=============== end cut ============

>============ cut for loadftp.cmd =============
>/* Test and-or load FTP RexxUtil */
>IF RxFuncQuery('FtpLoadFuncs') THEN
>    DO
>        If RxFuncAdd("FtpLoadFuncs","rxFtp","FtpLoadFuncs") then
>            DO
>            SAY "Could not load FTP environment"
>            RETURN 1
>            end
>        rc = FtpLoadfuncs()
>        END
>RETURN 0
>============== end cut ==================

>=========== cut for getk.cmd ===============
>/* get a buffer, CR terminated without echoing to screen */
>buf = ''; asc = 0
>do until asc = 13
>key = SysGetKey('noecho')
>asc = c2d(key)
>buf = buf || key
>end
>return buf
>================ end cut  ===================

>=Dwight=
>X1=L, X2=L & the domain is phonetic



Sun, 11 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ?FTP client against mainframe

2. Squeak FTP site established: ftp://ftp.create.ucsb.edu/pub/Smalltalk/Squeak

3. My ftp site (ftp://ftp.iag.net/pub/clipper)

4. Finding the JES2 PROC Name via an assembler program

5. $DILBERT macro in JES2 for OS/390 2.6.0

6. short-form replies in MVS 5.2/JES2

7. MVS 5.2 and JES2 4.3 MAS

8. MVS JES2 v4

9. "The History of HASP and JES2"

10. MVS/JES2/WTO(R)/CONSOLE AS/MPF exit/SUB SYSTEM

11. migrate Jobcontrol JES2 to Bat or REXX or ?

12. JES2 output

 

 
Powered by phpBB® Forum Software