cfSOFTWARE Contact Us Technical Support About Us cfSOFTWARE

corner
pcMAINFRAME Express
corner
  

pcMAINFRAME Express - Sample Job Stream

Jump to: CONNECT | PCSCRIPT1 | UPLOAD | PCSCRIPT2 | DOWNLOAD | PCSCRIPT3 | BOTTOM

//A0370CF1 JOB (0370,0100),'C+F',MSGCLASS=X
/* ----------------------------------------------------------------*
/*  UPLOAD DAILY SALES TO MAINFRAME AND DOWNLOAD SALES SUMMARY TO PC
/* ----------------------------------------------------------------*
//JOBLIB DD DSN=A0370.PCMAIN.LOADLIB,DISP=SHR
/*
//SALES1   EXEC PGM=CFXPRESS,PARM='LUNAME(CF32701)'
//REPORT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SALESNEW  DD  DSN=V0370.SALES001.SALESNEW,DISP=SHR
//SALESSUM  DD  DSN=V0370.SALES002.SALESSUM,DISP=SHR
//INPUT DD *
CONNECT
  APPLID(HIF0001)

PCSCRIPT
  * -- BEGIN CREATING A DIALOG SCRIPT ON THE PC
  OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE OVERWRITE
  WRITE (1) LINE 'OPTION LANGLEVEL(3)'
  WRITE (1) LINE 'DEVICE(NULL)'
  WRITE (1) LINE 'DLGBOX NEW'
  CLOSE (1)
  IF EXIST 'C:\SALES\MIDWEST\CHICAGODAILY.DAT' THEN
    * --CREATE BACKUP FILE NAME IN FORMAT CHICAGOMMDD
    SET MM = @SUBSTR(@DATE,1,2)
    SET DD = @SUBSTR(@DATE,4,2)
    SET BKUP = @STRCAT('C:\SALES\BKUP\CHICAGO',#MM,#DD,'.DAT')
    * --COPY CHICAGODAILY.DAT TO CHICAGOMMDD.DAT
    COPYFILE 'C:\SALES\MIDWEST\CHICAGODAILY.DAT' TO #BKUP
    END
  ELSE
    * --FILE NOT FOUND, SET USERRC AND EXIT
    QUIT(239)
  ENDIF
 /END

UPLOAD
  SKIPIF(USERRC,EQ,239)
  DEV(ESDS)
  DDNAME(SALESNEW)
  PCFILE(C:\SALES\MIDWEST\CHICAGODAILY.DAT)

PCSCRIPT
  IF &USERRC = 239 THEN
    * --FILE NOT FOUND, ADD A NOTEIFICATION MESSAGE TO THE DIALOG SCRIPT
    OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
    WRITE (1) LINE 'DLGBOX LINE1 = ''FILE CHICAGODAILY.DAT NOT FOUND'''
    CLOSE (1)
    END
  ELSE
    IF &LASTRC = 0 THEN
      * --UPLOAD SUCCESSFUL, ADD A NOTIFICATION MESSAGE TO THE DIALOG SCRIPT
      OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
      WRITE (1) LINE 'DLGBOX LINE1 = ''CHICAGODAILY.DAT UPLOAD GOOD'''
      CLOSE (1)
      * --DELETE CHICAGODAILY.DAT FROM PC
      DELETEFILE 'C:\SALES\MIDWEST\CHICAGODAILY.DAT'
    ELSE
      * --UPLOAD FAILED, ADD A NOTIFICATION MESSAGE TO THE DIALOG SCRIPT
      OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
      WRITE (1) LINE 'DLGBOX LINE1 = ''CHICAGODAILY.DAT UPLOAD FAILED'''
      CLOSE (1)
      END
    ENDIF
  ENDIF
  END
 /END

DOWNLOAD
  RUNIF(MAXRC,EQ,0)
  DEV(ESDS)
  DDNAME(SALESSUM)
  PCFILE(C:\SALES\NATIONAL\NATIONALDAILY.DAT)

PCSCRIPT
  IF &MAXRC = 0 THEN
    * --DOWNLOAD SUCCESSFUL, ADD A NOTIFICATION MESSAGE TO THE DIALOG SCRIPT
    OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
    WRITE (1) LINE 'DLGBOX LINE2 = ''NATIONALDAILY.DAT DOWNLOAD GOOD'''
    CLOSE (1)
  ELSE
    * --DOWNLOAD FAILED, ADD A NOTIFICATION MESSAGE TO THE DIALOG SCRIPT
    OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
    WRITE (1) LINE 'DLGBOX LINE2 = ''NATIONALDAILY.DAT DOWNLOAD FAILED'''
    CLOSE (1)
  ENDIF
  * --COMPLETE DIALOG SCRIPT AND NOTIFY PC USER OF STATUS
  OPEN(1) 'C:\TEMP\ASYNC.DLG' WRITE APPEND
  WRITE (1) LINE 'DLGBOX BUTTON1 = ''OK'''
  WRITE (1) LINE 'DLGBOX EXECUTE'
  CLOSE (1)
  * ----RUN DIALOGG.EXE AND DO NOT WAIT FOR COMPLETION
  RUN ASYNC 'C:\PCEXPRES\DIALOGG.EXE' 'C:\TEMP\ASYNC.DLG'
  END
/END
/*
//