## edi/ordernun - ORDERNET COMMUNICATIONS TEMPLATE - UNIX
##                Stuart Richler 12/10/97
##
## ************************************************************************* *
##             This is an unpublished work created in 1984 through 1998      *
## G.T.R. DATA INC. owns all rights to this work and intends to keep         *
## the work confidential so as to maintain its value as a trade secret.      *
## G.T.R. DATA INC. may also seek to protect this work as an unpublished     *
## copyright work. In the event of either inadvertent or deliberate          *
## publication,  G.T.R. DATA INC.  intends to enforce its rights for this    *
## work under the copyright laws as a published work; and to that end,       *
## G.T.R. DATA INC.   hereby affixes the following statutory notice:         *
##              (C) Copyright, G.T.R. DATA INC.  1984 through 1998.          *
## ************************************************************************* *
##
## This job file requires the following other files:
##
##
##
#################################################

## Monitor command in var1

MONITOR /usr/stuart/ord.mon -CO

## Config file

CONFIG /u1/edi74a00/edi/ordrncfg
LET PROTOCOL=ASCII
LOG /usr/stuart/script/ordernet.log -O
LET DEVICE=/dev/ttyi1c
LET MODEMINIT=AT&F&MX4V1QES8=5&C1&D1M1S0=1
LET informat=no

## Dial up

10 AUTODIAL 98795826 T60 R5

BRANCH ON BUSY TO 10
BRANCH ON DIAL_ABORT TO 150
BRANCH NOT OK TO 150

##LOGON

KEY
FIND ":"
KEY +
FIND ":"
KEY ONET,SSGATE
FIND "Connected to ONET"
KEY LOGON APPLID(EDIF)
FIND "SUPERTRACS READY FOR INPUT"

LOG Logged onto Ordernet.

## Send

## Check if the lock file exists in the output directory
EXISTS /usr/stuart/output/lock
BRANCH ON NOFILE TO 50
LOG Output Directory is currently locked...try again later.
BRANCH ON TRUE TO 80

## Check if there is anything to send
50 EXISTS /usr/stuart/output/ediout
BRANCH ON NOFILE TO 80

## There is, so append the job card record to the top of the file
OPEN /usr/stuart/output/ident -O
WRITE \036\036ADD ID=SAK35T BATCHID='3056401'\013
CLOSE
SYSTEM cat /usr/stuart/output/ident /usr/stuart/output/ediout > /usr/stuart/output/sendfile

## Send file to Ordernet
SEND /usr/stuart/output/sendfile
KEY \04
BRANCH NOT NRMEOF TO 500

LOG Output file /usr/stuart/output/ediout sent.

## Erase send file
SYSTEM rm /usr/stuart/output/ediout


## Receive
FIND "SUPERTRACS READY FOR INPUT"
80 KEY \036\036REQUEST ID=SAK35T BATCHID='3056401'\013\004 -R
RECEIVE /usr/stuart/input/temp

LOG File /usr/stuart/input/temp received.


VOICE
LOG Signed off from Ordernet.

## Check for directory lock on receive directory.
EXISTS /usr/stuart/input/lock
BRANCH ON NOFILE TO 100
LOG Input file received but not transferred to /usr/stuart/input/ediin
LOG because direcory is locked.
BRANCH ON TRUE TO 800

## Make list of input files
100 SYSTEM ls /usr/stuart/input/temp*.* > /usr/stuart/input/filelist
OPEN /usr/stuart/input/filelist

110 READ filename
BRANCH ON NODATA TO 120

## Check to see if file is wrapped, if it is then unwrap it.
IF $informat=no
  SYSTEM unwrap.sh ~ $filename
ENDIF

## Concatenate file to Input file.
SYSTEM cat /usr/stuart/input/ediin $filename > /usr/stuart/input/tempfile
SYSTEM mv /usr/stuart/input/tempfile /usr/stuart/input/ediin
BRANCH ON TRUE TO 110


## Finished; erase input files
120 SYSTEM rm /usr/stuart/input/temp*.*




QUIT

150 VOICE
LOG Errored out on call
QUIT 10

500 VOICE
LOG Ordernet transmission of file /usr/stuart/output/ediout failed.
QUIT 50

800 VOICE
LOG Ordernet receipt of file /usr/stuart/input/temp failed.
QUIT 80