with a little help from my friends: how hlasm interacts ...€¦ · with a little help from my...

57
With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and Sharuff Morsa IBM [email protected] [email protected] Thursday, August 15, 2013 Session Number 14084 Insert Custom Session QR if Desired.

Upload: others

Post on 18-Jun-2020

2 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ

Barry Lichtenstein and Sharuff Morsa [email protected]@us.ibm.com

Thursday, August 15, 2013 Session Number 14084

InsertCustomSessionQR if Desired.

Page 2: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: Introduction

Assembler application programming with

BinderCCICS MQLanguage Environment

2

Page 3: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C (or is this LE?)

Inter language communication (ILC) for ‘small, simple assembler module’…..

C provides the #pragma linkage directive It identifies the entry point of modules that are used in

interlanguage calls from C programs #pragma linkage(PROG1,OS)

Designates PROG1 as an OS linkage entry point. If the C program is compiled with NOXPLINK, on entry to the

called routine, R13 points to a standard Language Environment stack frame, beginning with a 72-byte save area.

3

Page 4: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

Lets start with a simple C program as an example. Our C program: CLOCKC invoking GETSTCK, our

assembler routine

#pragma linkage(GETSTCK,OS)

GETSTCK:• returns the current STCK or STCKF or STCKE value • Does not have any working storage

4

Page 5: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

5

Page 6: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

6

Page 7: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

7

Page 8: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

8

Page 9: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

9

Page 10: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

10

Page 11: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

11

Page 12: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

12

Page 13: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

13

Page 14: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: C …

14

Page 15: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS

CICS assembler programs need to be translated (no integrated translator)

15

Page 16: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

What does the translator do for me? converts EXEC CICS commands into assembler macro invocationsinserts macro definitions for working storageconverts return code checking

Assembler arguments passed in CICS commandsGenerally, an argument can be either

the address of the data or the data itself

ie either a relocatable expression or an absolute expression

16

Page 17: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

Page 18: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

Translator insertsDFHEIGBL

This macro sets globals

DFHEIENT This macro is inserted after the first CSECT. It performs prolog code:

Saves registers

Gets an initial allocation of the storage defined by DFHEISTG)

Sets up a base register (default register 3)Sets up a dynamic storage register (default register 13)

Sets up a register to address the EIB (default register 11)

18

Page 19: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

Translator insertsDFHEIRET

This macro performs epilog code:Restores registers

Allows a RC to be passed back to the caller

Returns control to the address in register 14

DFHEISTG and DFHEIENDThese macros define dynamic storage:

Define the storage required for the parameter list

Define a save area

DFHEIBLKCopybook containing a DSECT that describes the EIB

19

Page 20: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

…and the translator converts…

…assembler arguments: examples

CLC EIBRESP,DFHRESP(NOSPACE)

…becomes

CLC EIBRESP,=F’18’

20

Page 21: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

…and the translator converts…

…a simple CICS command EXEC CICS RETURN to a macro invocation: DFHECALL …

HLASM and friends: CICS …

21

Page 22: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

…which get assembled as…

… CICS macros can be found in cicshlq.SDFHMAC

HLASM and friends: CICS …

22

Page 23: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

23

CICS

Green

Screen

Page 24: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

…the ‘glue code’ …… load register 15

LLGT 15,=V(DFHEG1)

… DFHEG1 is resolved by the inclusion of the DFHEAG stub routine…

INCLUDE SYSLIB(DFHEAG)

…which is later resolved by the Binder so that at execution time we branch to it…

BASR 14,15

HLASM and friends: CICS …

24

Page 25: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

25

Page 26: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

Page 27: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

27

Page 28: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

28

Page 29: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

(another)CICS

Green

Screen

Page 30: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

30

V-type symbols: DFHEAG0 and DFHEG1

Page 31: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: CICS …

31

Page 32: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ

Data structuresprovided as macros:

CMQODA object descriptorCMQMDA message descriptorCMQGMOA get message options

CMQA constants

Found in mqhlq.SCSQMACS

32

Page 33: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

Data structures …

33

Page 34: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …&VERSION=MQOD_VERSION_1, &OBJECTTYPE=MQOT_Q,

constants defined in CMQA

Page 35: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

API calls… uses standard assembler CALL macro

MQOPEN open a queueMQGET get a messageMQPUT put a messageMQCLOSE close a queue

35

Page 36: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

Page 37: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

MQCONN with four parameters

Page 38: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

MQOPEN with six parameters

Page 39: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

•BRAS r15 addresses v-conn

•DC V(MQCONN) v-conn resolved at load

•L 15,0(15,0) r15 loads vconn

•BALR ..and go invoke

Page 40: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

• The MQ api is a call interface• Assembler programs must observe the OS linkage

convention• Before you issue any MQ apI call, your programs must point

R13 at a save area of at least 18 full words• Create static versions of the structures• Allocate storage for dynamic structures• Copy static versions to dynamic storage• Invoke API

MQ sample can be found in mqhlq.SCSQASMS

40

Page 41: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

41

&OPTIONS=(MQGMO_NO_WAIT+MQGMO_PROPERTIES_AS_Q_DEF),

OPTIONS = ( ZERO + ZERO ) !

Page 42: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

42

MQGMO_BROWSE_NEXT EQU X'00000020' MQGMO_ACCEPT_TRUNCATED_MSG EQU X'00000040' MQGMO_FAIL_IF_QUIESCING EQU X'00002000'

…and save the result …

ST R0,GETMSGOPTS_OPTIONS Indicate get options

Page 43: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

43

Page 44: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

44

Page 45: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

45

Page 46: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: MQ …

46

Page 47: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE

47

Page 48: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

48

LE-conforming assemblerAn LE-conforming assembler program is a program thatuses the LE provided macros to generate the requiredprolog and epilog code, and follows the register conventionsof LE.

Macros… CEEENTRY and CEETERM

Do you remember …DFHEIENT DATAREG=…. and DFHEIRET … and DFHEISTG … and DFHEIEND … from the earlier slides ?Is there anything new under the sun ?

Page 49: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

49

AUTO=WORKSIZE

Your programs working storage

Page 50: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

50

return code can be a fixed constant, variable,or register 2–12

Page 51: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

51

LE macros are in your lehlq..SCEEMAC

Page 52: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

52

Using LE callable services… examples

CEELOCT Gets current date and time

CEEDATM Converts number of seconds to character timestamp

CEEMOUT Write a message

The LE callable services are also available to other languages

Page 53: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

53

Page 54: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

54

...or simply use the standard call macro…CALL CEELOCT(…,…,…,…),VL,MF=(..)

Page 55: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

55

Binder XREF ..

Page 56: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

56

Page 57: With a Little Help from My Friends: How HLASM Interacts ...€¦ · With a Little Help from My Friends: How HLASM Interacts with LE, Binder, C, CICS and MQ Barry Lichtenstein and

Session Number 14084

HLASM and friends: LE …

57

And finally …..