HP3000-L Archives

December 1998, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Robert Rose <[log in to unmask]>
Reply To:
Robert Rose <[log in to unmask]>
Date:
Fri, 18 Dec 1998 15:05:26 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (163 lines)
Cary,

  This is a job stream we used to use to send spoolfiles to a network server.

  It uses a fair amount of STREAMX code.  I assume you've got STREAMX.

::ECHO            Begin FTP SPOOL FILE TRANSFER at !hptimef
::ECHO
::PROMPT INTEGER SPF = &
::  "Enter the spool file # to transfer, <CR> to quit: ";DEFAULT=-1;&
::  CHECK=(BETWEEN(SPF,-1,9999999) AND &
::    (SPF = -1 OR FEXISTS("O"+STRWRITE(SPF)+".OUT.HPSPOOL")));&
::  CHECKERROR="Spool file does not exist, please reenter."
::IF SPF = -1 THEN
::  ECHO
::  ECHO NO SPOOL FILES TO TRANSFER, JOB WILL NOT BE STREAMED.
::  EXIT
::ENDIF
!JOB JUTFT001,JOB.{HPACCOUNT},FTP;INPRI=7;OUTCLASS=LP,1
!#######################################################################
!#                          FTP SPOOL FILE TRANSFER                    #
!#                                                                     #
!#            Prompts for a series of spool file numbers.  Each spool  #
!#          file must exist in the OUT.HPSPOOL group.  Converts each   #
!#          spool file to an ASCII bytestream file using the utility   #
!#          program TOBYTE, found in /SYS/HPBIN/.  The output file     #
!#          name is the file designator of the spool file (INVOICES,   #
!#          MONTPICK, etc).  The job then starts FTP, which is in      #
!#          /SYS/ARPA/, to connect to the TRICORD server as an         #
!#          anonymous user, removes any existing version of the file,  #
!#          and transfers the HP file to the server.  The SMARTi       #
!#          scheduler will then process the file.                      #
!#                                                                     #
!#          NOTE: The /SYS/HPBIN and /SYS/ARPA directories must be in  #
!#                the path for this job to work correctly.             #
!#                                                                     #
!#         10/01/95 BR  Created for request 3519508.                   #
!#         10/21/96 BR  Changed server to MNI-AIMAGE, user to SMARTI   #
!#                      and download directory to /IMAGES/SMARTI.      #
!#######################################################################
!CONTINUE
!#######################################################################
!#  1. Set the path to include the iX tools directories.               #
!#######################################################################
!SETVAR HPPATH "HPBIN.SYS,ARPA.SYS,!HPPATH"
!#######################################################################
!#  2. Set some useful variables for the maximum length of a spool     #
!#     file designator, the maximum length of a spool file state, the  #
!#     address of the server, etc.                                     #
!#######################################################################
!SETVAR _MAX_FNAME 8
!SETVAR _MAX_SPFSTATE 7
!SETVAR _FTP_SERVER "MNI-AIMAGE"
!SETVAR _FTP_USER "SMARTI"
!SETVAR _FTP_DIR "/IMAGES/SMARTI"
!SETVAR _FTP_MODE "ASCII"
!#######################################################################
!#  3. Loop until the user is finished.                                #
!#######################################################################
::WHILE SPF <> -1
::  ASSIGN SPOOL_FILE = "O" + STRWRITE(SPF) + ".OUT.HPSPOOL"
!#######################################################################
!#  4. Check that the spool file is ready.                             #
!#######################################################################
!   CONTINUE
!   SPOOLF {SPF};SHOW >TEMP1
!   PRINT TEMP1;START=2;END=2 >TEMP2
!   INPUT _HEAD <TEMP2
!   SETVAR _FILEDES_POS ![POS("FILEDES","!_HEAD")]
!   SETVAR _STATE_POS ![POS("STATE","!_HEAD")]
!   IF _FILEDES_POS = 0 OR _STATE_POS = 0 THEN
!     TELLOP ![CHR(7)]
!     TELLOP ERROR GETTING SPOOLFILE INFORMATION FOR "{SPOOL_FILE}"
!     TELLOP ABORTING JOB #!HPJOBTYPE!HPJOBNUM, !HPJOBNAME
!     SPOOLF {SPF};SHOW
!     ESCAPE
!   ENDIF
!   PRINT TEMP1;START=![FINFO("TEMP1","EOF")] >TEMP3
!   INPUT _REC <TEMP3
!   SETVAR _SPF_STATE "![STR("!_REC", !_STATE_POS, !_MAX_SPFSTATE)]"
!   SETVAR _SPF_STATE "![LTRIM(RTRIM("!_SPF_STATE"))]"
!   IF _SPF_STATE <> "READY" AND _SPF_STATE <> "SPSAVE" THEN
!     TELLOP ![CHR(7)] &
!     TELLOP SPOOL FILE {SPOOL_FILE} STATE IS "!_SPF_STATE"
!     TELLOP ABORTING JOB #!HPJOBTYPE!HPJOBNUM, !HPJOBNAME
!     SPOOLF {SPF};SHOW
!     ESCAPE
!   ENDIF
!#######################################################################
!#  5. Get the file designator for the spool file.                     #
!#######################################################################
!   SETVAR _SPF_DESIG "![STR("!_REC", !_FILEDES_POS, !_MAX_FNAME)]"
!   SETVAR _SPF_DESIG "![LTRIM(RTRIM("!_SPF_DESIG"))]"
!#######################################################################
!#  6. Convert the spool file to byte stream format.                   #
!#######################################################################
!   CONTINUE
!   PURGE !_SPF_DESIG
!   TOBYTE "-at {SPOOL_FILE} !_SPF_DESIG"
!#######################################################################
!#  7. Create a temp file for FTP to connect to the server, change to  #
!#     the correct server and directory, remove any existing version   #
!#     of the target file, transfer the source file to the server,     #
!#     close the connection, and exit FTP.  Leave the source file on   #
!#     the HP for recovery purposes.                                   #
!#######################################################################
!   CONTINUE
!   PURGE FTPIN,TEMP
!   CONTINUE
!   PURGE FPTIN
!   comment ** Connect to the remote system
!   ECHO OPEN !_FTP_SERVER                >>FTPIN
!   comment ** Establish a session
!   ECHO USER !_FTP_USER                  >>FTPIN
!   comment ** Move to the target directory
!   ECHO CD !_FTP_DIR                     >>FTPIN
!   comment ** Set proper transfer mode
!   ECHO !_FTP_MODE                       >>FTPIN
!   comment ** Delete old version of target
!   ECHO DELETE !_SPF_DESIG.SPF           >>FTPIN
!   comment ** Transfer source file to remote system
!   ECHO PUT !_SPF_DESIG !_SPF_DESIG.SPF  >>FTPIN
!   comment ** Close the connection
!   ECHO CLOSE                            >>FTPIN
!   comment ** Terminate the FTP session
!   ECHO EXIT                             >>FTPIN
!   comment ** Now run FTP from the command file
!   FTP <FTPIN
!#######################################################################
!#  8. Check the FTPLASTERR variable for any problems.  If it is not   #
!#     equal to zero, tell the operator what the code and error        #
!#     message are, then use the ESCAPE command to terminate the job   #
!#     abnormally.                                                     #
!#######################################################################
!  IF FTPLASTERR <> 0 THEN
!    TELLOP ![CHR(7)]
!    TELLOP ![CHR(7)]
!    TELLOP ![CHR(7)]
!    TELLOP AN FTP ERROR OCCURRED IN !HPJOBNAME.
!    TELLOP THE ERROR CODE AND DESCRIPTION FOLLOW.
!    TELLOP
!    TELLOP FTP ERROR CODE !FTPLASTERR
!    TELLOP FTP ERROR DESC !FTPLASTMSG
!    TELLOP
!    TELLOP ABORTING...
!    ESCAPE
!  ENDIF
!#######################################################################
!#  9. Get the next spool file.                                        #
!#######################################################################
::  PROMPT INTEGER SPF = &
::    "Enter the spool file # to transfer, <CR> to quit: ";DEFAULT=-1;&
::    CHECK=(BETWEEN(SPF,-1,9999999) AND &
::      (SPF = -1 OR FEXISTS("O"+STRWRITE(SPF)+".OUT.HPSPOOL")));&
::    CHECKERROR="Spool file does not exist, please reenter."
::ENDWHILE
!#######################################################################
!# 10. All done, nothing to clean up.                                  #
!#######################################################################
!EOJ

Hope this helps, Bob

ATOM RSS1 RSS2