Hi,
i'd like to create a z/OS batch application that will act like an http client. I did a similar application in PL/I using the z/OS http enabler toolkit ( using the http protocol enabler part ).
I was able to link my egl basic program with the link stub of the toolkit after editing FDABCL:
//X IF &HASLKG..EQ.YES //L2 EXEC PGM=IEWL,REGION=&RGN, //* PARM='RENT,REUS,LIST,XREF,MAP,AMODE(31),RMODE(ANY)' // PARM='RENT,REUS,LIST,XREF,MAP,AMODE(31)' //SYSLIB DD DISP=SHR,DSN=&COBLIB //SELALMD DD DISP=SHR,DSN=&ELA..SELALMD //LINK01 DD DISP=SHR,DSN=&LINKLIB //SYSLIN DD DSN=&CGHLQ..&SYSTEM..EZELKG(&MBR),DISP=SHR //*SYSLIN DD CCUEXT=LKG,DISP=(NEW,DELETE), //* UNIT=SYSDA,SPACE=(CYL,(999,999),RLSE), //* DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) //OBJLIB DD DISP=SHR,DSN=&CGHLQ..&SYSTEM..OBJECT //SYSLMOD DD DISP=SHR,DSN=&CGHLQ..&SYSTEM..LOAD //SYSPRINT DD CCUEXT=&CCUEXTL,DISP=(NEW,DELETE), // UNIT=VIO,SPACE=(CYL,(999,999),RLSE), // DCB=(RECFM=FB,LRECL=121,BLKSIZE=1210) //SYSUT1 DD SPACE=(1024,(&WSPC,&WSPC)),UNIT=VIO //*PROVIDE ANY CUSTOM DD STATEMENTS HERE //X ENDIF //*************************************************************
I pass the link library as a symbolic given in the build descriptor( LINK01). Also, instead of relinking i did the whole linking in this section.
After all, i can run the generated program and i can get correct return codes and messages (defined in the documentation) back from the services, so i can access them.
My issue with making this work in EGL is that i am not sure how to pass data to the services. As soon as i need to pass parameters that are addresses of buffers i got into trouble and got error messages indicating that the parameter in question is invalid (inaccessible storage ) or empty, depending on what data type i try to use.
HWTH-RETURN-CODE int;Conn-Handle hex(24); // 12 byteHWTH-DIAG-AREA char(136);HWTH_HANDLETYPE_CONNECTION hex(8) = X"00000001";HWTH_HANDLETYPE_HTTPREQUEST hex(8) = X"00000002";HWTH_HANDLETYPE.VALUE = HWTH_HANDLETYPE_CONNECTION;call "HWTHINIT"(HWTH-RETURN-CODE, HWTH_HANDLETYPE.VALUE, Conn-Handle, HWTH-DIAG-AREA);Record HWTH_HANDLETYPE type basicRecord 01 VALUE hex(8);end
This call is working just fine as the parameter list doesn't have any tricky element. However i cannot make the next one work:
call "HWTHSET"(HWTH-RETURN-CODE, Conn-Handle, HWTH_OPT_URI, uri, length, HWTH-DIAG-AREA);
Where uri is expected to be the address of a buffer holding some string.
I tried several data type for uri but none of them worked, and the generated cobol code dosen't seem right either. Using string e.g. will map to some unintelligible structure (for me):
CALL EZEPROGM USING HWTH-RETURN-COD-2 CONN-HANDLE-3 HWTH-OPT-URI-29 URI-36 LENGTH-43 HWTH-DIAG-AREA-7
where URI-36 is a pointer but i believe it doesn't point to what i need:
04 URI-36 USAGE IS POINTER.
And is filled like:
* EGL *27* uri = "something";SET URI-36 TO EZESTR-40 ...SET EZESTR-40 TO ADDRESS OF EZETYPE-STRING0MOVE EZESTR-39 TO EZETYPE-DATA IN EZETYPE-STRING0 (1:EZETYPE-LENGTH IN EZETYPE-STRING0) ...MOVE "something" TO EZESTR-39-1-----02 EZESTR-39-FILLER. 03 EZESTR-39-1 PIC N(9) USAGE NATIONAL. 02 EZESTR-39 REDEFINES EZESTR-39-FILLER PIC N(9) USAGE
Unfortunately EZETYPE-STRING0 is not a simple buffer-like thing but:
01 EZETYPE-STRING0. 02 EZETYPE-HEADER. 03 EZETYPE-TYPEPTR USAGE IS POINTER. 03 EZETYPE-TOTAL-LENGTH PIC 9(9) COMP-4. 03 EZETYPE-GARBCOLL-KEY PIC 9(9) COMP-4. 03 EZETYPE-LENGTH PIC 9(9) COMP-4. 03 EZETYPE-PTR-ALIGNMENT PIC X(4). 02 EZETYPE-DATA PIC N(32767) USAGE NATIONAL.
Long story short: can you help me how to overcome this issue? What datatype should i use that is a simple array of bytes and i can pass the address of it?
Daniel_Bekesi