03 ENV_NAME pic X(n) 03 ENV_VAL pic X(n) call GETENV using ENV_NAME ENV_VAL
03 WAIT pic 9(4) comp-1. call DELAY using WAIT.
03 UID_E pic 9(4) comp-1. 03 UID_R pic 9(4) comp-1. 03 UID_S pic 9(4) comp-1. 03 UID_L pic 9(4) comp-1. Call UIDS using UID_E UID_R UID_S UID_L
03 NAME pic X(n). 03 ERR pic 9(4) comp-1. call UTOUCH using NAME ERR.
03 M-ROW pic 9(4) comp-1. 03 M-COL pic 9(4) comp-1. call ROWCOL using M-ROW, M-COL.
03 WAIT pic 9(4) comp-1. call DELAY using WAIT.
03 PRI pic 9(4) comp-1. call GETPRI using PRI.
03 PRI pic 9(4) comp-1. call SETPRI using PRI.
03 PRI pic 9(4) comp-1. call NICE using PRI.
Caution when replacing an entery the memory used for the previous entry is not reclaimed. Under no circumstances may programs make repeated changes to environment variables.
call PUTENV using ENV_NAME ENV_VALUE; ON EXCEPTION MOVE "PUTENV not supported" TO ENV-VAL.
On AIX 3.1, 3.2, 4.1, 4.2 pid is a 32bit number. From AIX 4.3 onwards it may be a 64bit number depending on the setup.
03 PID_VALUE pic 9(18) comp-4. call PID using PID_VALUE; ON EXCEPTION MOVE "PID not supported" TO ENV-VAL.
They use the following variables for there calls.
03 NAME pic X(256). 03 TAG. 05 TAG_Dataset pic X. 05 TAG_Company pic X. 03 EDI-LINE. 05 line-type. 07 line-basetype pic X(3). 07 line-subtype pic X . 05 line-ver pic 9(2). 05 line-data. 07 Filler pic X(1018). 03 FILE pic X(256). 03 HOST PIC X(40). 03 IP pic X(15). 03 ERR pic 9(4) comp-1. 88 NOFILE value 100. 88 NOHOST value 200. 88 NOIP value 201. 88 NOROUTE value 202. 88 NOPORT value 203. 88 NOSOCKET value 204. 88 NOCONNECT value 205. 88 NOPEER value 206. 88 EDI_WRITE value 207. 88 TAGERR value 300.
Move "editest.roadrunner.uk.com" to HOST MOVE "ZA" to tag MOVE SPACES to EDI-LINE. Move "TEST" to line-type. Move 00 to line-ver. Move "Test message" to line-data. MOVE SPACES to ENV-VAL. MOVE 0 to ERR. CALL "EDIL2HOST" USING EDI-LINE, TAG, HOST, ERR; ON EXCEPTION MOVE "EDIL2HOST not supported" TO ENV-VAL.
call EDIL2IP using LINE TAG IP ERR; ON EXCEPTION MOVE "EDIL2IP not supported" TO ENV-VAL.
call EDIF2HOST using FILE TAG HOST ERR; ON EXCEPTION MOVE "EDIF2HOST not supported" TO ENV-VAL.
call EDIF2IP using FILE TAG IP ERR; ON EXCEPTION MOVE "EDIF2IP not supported" TO ENV-VAL.
03 PATH PIC X(400). 03 PERM PIC 9(4) comp-1. 03 ERR pic 9(4) comp-1. 88 NOFILE value 100. 88 NOHOST value 200. 88 NOIP value 201. 88 NOROUTE value 202. 88 NOPORT value 203. 88 NOSOCKET value 204. 88 NOCONNECT value 205. 88 NOPEER value 206. 88 EDI_WRITE value 207. 88 TCP_CLOSE value 208. 88 EDI_READ value 209. 88 TIME_OUT value 210. 88 TAGERR value 300. 03 Buffer PIC x(4000). 03 size pic 9(4) comp -1.
Call set works with a single connection. Close the connection before attempting to open another.
move 0 to ERR. move "/var/www/pub/someware/pic.png" to PATH. move 0 to PERM. call FileCreate useing PATH, PERM, ERR; ON EXCEPTION MOVE "FileCreate not supported" TO ENV-VAL.
size=0 implies read upto the size of the Buffer.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
On return size idecates the number of bytes actualy read.
move 0 to ERR. call FileRead useing Buffer, ERR, size; ON EXCEPTION MOVE "FileRead not supported" TO ENV-VAL. DISPLAY Buffer.
or alternatively
move 30 to grace. move 0 to ERR. move 20 to size. call FileRead useing Buffer, ERR, size, grace; ON EXCEPTION MOVE "FileRead not supported" TO ENV-VAL. DISPLAY Buffer.This is not quite right if timer expires we may only have read a partial block.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. call FileReadln useing Buffer, ERR; ON EXCEPTION MOVE "FileReadln not supported" TO ENV-VAL. DISPLAY Buffer.
or alternatively
move 30 to grace. move 0 to ERR. call FileReadln useing USER, ERR, grace; ON EXCEPTION MOVE "FileReadln not supported" TO ENV-VAL. DISPLAY Buffer.
On exit size is teh number of bytes actualy sent.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. move "What ever we like."to Buffer. move 18 to size. call FileWrite useing Buffer, ERR, size; ON EXCEPTION MOVE "FileWrite not supported" TO ENV-VAL.
or alternatively
move 30 to grace. move 0 to ERR. move "What ever we like."to Buffer. move 18 to size. call FileWrite useing Buffer, ERR, size, grace; ON EXCEPTION MOVE "FileWrite not supported" TO ENV-VAL.This is not quite right should be able to write a partial structure, and return the amount written.
If stucture contains a null this will terminate the line.
Trailing space is removed, remaining line is sent.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. move "What ever we like. " to Buffer. call FileWriteln useing Buffer, ERR; ON EXCEPTION MOVE "FileWriteln not supported" TO ENV-VAL.
or alternatively
move 30 to grace. move 0 to ERR. move "What ever we like. " to Buffer. call FileWriteln useing Buffer, ERR, grace; ON EXCEPTION MOVE "FileWriteln not supported" TO ENV-VAL.
move 0 to ERR. call FileClose using ERR; ON EXCEPTION MOVE "FileClose not supported" TO ENV-VAL.
03 HOST PIC X(40). 03 SERVICE PIC X(10). 03 IP pic X(15). 03 ERR pic 9(4) comp-1. 88 NOFILE value 100. 88 NOHOST value 200. 88 NOIP value 201. 88 NOROUTE value 202. 88 NOPORT value 203. 88 NOSOCKET value 204. 88 NOCONNECT value 205. 88 NOPEER value 206. 88 EDI_WRITE value 207. 88 TCP_CLOSE value 208. 88 EDI_READ value 209. 88 TIME_OUT value 210. 88 TAGERR value 300. 03 Buffer PIC x(40). 03 size pic 9(4) comp -1.
Call set works with a single connection. Close the connection before attempting to open another.
move 0 to ERR. move "pop3.roadrunner.uk.com" to HOST. move "pop3" to SERVICE. call TcpOpen2Host useing HOST, SERVICE, ERR; ON EXCEPTION MOVE "TcpOpen2Host not supported" TO ENV-VAL.
size=0 implies read upto the size of the Buffer.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
On return size idecates the number of bytes actualy read.
move 0 to ERR. call TcpRead useing Buffer, ERR, size; ON EXCEPTION MOVE "TcpRead not supported" TO ENV-VAL. DISPLAY Buffer.
or alternatively
move 30 to grace. move 0 to ERR. move 20 to size. call TcpRead useing Buffer, ERR, size, grace; ON EXCEPTION MOVE "TcpRead not supported" TO ENV-VAL. DISPLAY Buffer.This is not quite right if timer expires we may only have read a partial block.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. call TcpReadln useing Buffer, ERR; ON EXCEPTION MOVE "TcpReadln not supported" TO ENV-VAL. DISPLAY Buffer.
or alternatively
move 30 to grace. move 0 to ERR. call TcpReadln useing USER, ERR, grace; ON EXCEPTION MOVE "TcpReadln not supported" TO ENV-VAL. DISPLAY Buffer.
On exit size is teh number of bytes actualy sent.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. move "What ever we like."to Buffer. move 18 to size. call TcpWrite useing Buffer, ERR, size; ON EXCEPTION MOVE "TcpWrite not supported" TO ENV-VAL.
or alternatively
move 30 to grace. move 0 to ERR. move "What ever we like."to Buffer. move 18 to size. call TcpWrite useing Buffer, ERR, size, grace; ON EXCEPTION MOVE "TcpWrite not supported" TO ENV-VAL.This is not quite right should be able to write a partial structure, and return the amount written.
If stucture contains a null this will terminate the line.
Trailing space is removed, remaining line is sent.
If specified grace is the maximum amount of time to block, if not specified a default value of 30 seconds is used..
move 0 to ERR. move "What ever we like. " to Buffer. call TcpWriteln useing Buffer, ERR; ON EXCEPTION MOVE "TcpWriteln not supported" TO ENV-VAL.
or alternatively
move 30 to grace. move 0 to ERR. move "What ever we like. " to Buffer. call TcpWriteln useing Buffer, ERR, grace; ON EXCEPTION MOVE "TcpWriteln not supported" TO ENV-VAL.
move 0 to ERR. call TcpClose using ERR; ON EXCEPTION MOVE "TcpClose not supported" TO ENV-VAL.
03 HTTP_version pic X(20). 03 HTTP_status pic 9(4) comp-1. 03 HTTP_server_message pic X(80). 03 HTTP_realm pic X(20). 03 HTTP_userid pic X(10). 03 HTTP_passwd pic X(10).
Question what information if any from the servers headers do we want to return to the calling program.
move "www.ooo.xxx" to host. move "faq/rmcalls.html" to url. move 0 to ERR. call HttpGet using host, url, ERR, user, passwd, HTTP_version, HTTP_status, HTTP_server_message; ON EXCEPTION MOVE "HttpGet not supported" TO ENV-VAL.
On exit ERR is non zero if a problem prevents the request from beeing made.
HTTP_version is inialized the to server ID string.
HTTP_Status is set to the server status for the request {200 successfull, 403 Access denied, ...}
HTTP_server_message is initalized to the status message from the server.
If successfull the datalink is initalized at the start of the content block.
Successive calls to ______Read may be made to read the contents of the "file".
HttpPut
Put New or Replacement file to server.
HttpPost
?
HttpReadHeader
Read one line from the set of headers returned on the last Get, Head, ...
move 0 to ERR.
call HttpReadHeader using header, ERR;
ON EXCEPTION MOVE "HttpReadHeader not supported" TO ENV-VAL.
Draft routines are done as RMcobol 7.xx extension library.
All cobol calls are to start "DG_" so as to avoide clashes with outer modules.
Think of Parafin, it can be shipped as bulk liquid, 40Gal drums, or 4.5 liter plastic bottles in cardboard cartons.
So we need to read the shipping description database to identify the exact item and form of packing.
READDGSHIPING snag, call returns a linked list. we therefore need two calls 1> Call to initalize the list for a given unno 2> Call to read entery from list We can either return a count on the first call, or a flag indecating more to read on each subsequent call.
03 unno pic S9(7) usage comp-4. {NBS2 type 11} 03 found pic A. {ABS type 18 J-left} move 1203 to unno call DG_InitShippingList using unno, found. if found == 'N' Then display "unno not found in database" if found == 'Y' Then display "unno found in database" if found == 'E' Then display "Error accessing un database for unno" 03 05 name pic X(60). {ANS type 16 J-left, type 17 J-right} 05 unsub pic X(4). 05 ununique pic S9(7) usage comp-4. 03 more pic A. {ABS type 18 J-left} call DG_ReadShippingList using name, unsub, ununique, more. if more == 'E' Then display "Error accessing database or attempt to read past end" display name display unsub display ununique if more == 'N' Then display "This is the last record" if more == 'Y' Then display "More records exist in the database"
03 05 unno pic S9(7) usage comp-4. 05 unsub pic X(4). 05 ununique pic S9(7) usage comp-4. 03 dgdata 05 shippingName pic X(60). 05 class pic X(4). 05 classColumn pic S9(7) usage comp-4. 05 subrisk1 pic X(4). 05 subrisk1Column pic S9(7) usage comp-4. 05 subrisk2 pic X(4). 05 subrisk2Column pic S9(7) usage comp-4. 05 hazchen pic X(5). 05 hazchen pic X(5). 05 pkgrp1 pic X(3). 05 pkgrp2 pic X(3). 05 pkgrp3 pic X(3). 05 epg pic X(8). 05 wmsgrp pic X(2). 05 printMsg pic X(22). 03 stat pic A. {ABS type 18 J-left} call DG_ReadMaster using unno unsub ununique shippingName class classColumn subrisk1 subrisk1Column subrisk2 subrisk2Column hazchen pkgrp1 pkgrp2 pkgrp3 epg wmsgrp printMsg stat if stat == 'N' then display "Oops no record for that code" if stat == 'Y' then display "Details for unique item found" if stat == 'E' then display "Error accessing database."*/ /* --------------------------------------------------------------------
For this we need to assemble an array of from 1 to 16 Class codes.
These are 4byte alphanumberic plus null termination, unused enteries are to be set to ????
17th entery is new class?
The function call returns a 4 character message code :-
'0001' File access error '0010' Invalid Class code in position X1 '0011' Incompatible Classes in position X1 and X2 may not be combined in a shipment '0012' No problems found but check on sub risks. '1001'-'1008' acknolageable problem. int index of first incompatible class code. int index of 2nd incompatible entery char ERRFLAG {' ', 'E'}
The example program at Patrick's, does not use the new class field.... It erases array to spaces, and then loads the supplied class codes into the class array.
The function is then called repetedly until it returns with ERRFLAG set to E or final is set to Y..... ?????
03 DG-CLassArray 05 ClassCode pic X(4) occurs 16. 03 DG-StatusCode pic X(4). 03 DG-Index1 pic 9999 comp-1. 03 DG-Index2 pic 9999 comp-1. call DG_compat_init using DG-CLassArray call DG_compat_readMessage using DG-StatusCode, DG-Index1. DG-Index2, more. Fatal :- 0001 Call support - Could not read Class table?\n 0010 printf("Class %4.4s is invalid\n", &classArray[err1No-1]); Error :- 0011 printf("Class %4.4s and %4.4s are not compatible %4.4s\n", &classArray[err1No-1], &classArray[err2No-1], errorCode); Warning :- 1001 printf("Class %4.4s and %4.4s - Check Note 1\n", &classArray[err1No-1], &classArray[err2No-1]); 1002 " 1003 .. 1008 ???? printf("Class %4.4s and %4.4s - unknown error %4.4s\n", &classArray[err1No-1], &classArray[err2No-1], &errorCode); printf("Call Support now\n"); ??? :- 0012 printf("Compatible but check the sub risks\n");