High Level Assembler (HLASM)
with Language Environment (LE)

This program reads an input file and excludes duplicate records in the output file.
The primary purpose of this example shows how to add LE support to Assembler programs
    
 

                 TITLE 'High Level Assembler with Language Environment and CEEUOPTS override'
	*
	R0	EQU	0
      	R1	EQU	1
	R2	EQU	2
	R3	EQU	3
	R4	EQU	4
	R5	EQU	5
	R6	EQU	6
	R7	EQU	7
	R8	EQU	8
	R9	EQU	9
	R10	EQU	10	Base Register for executable code
	R11	EQU	11
	R12	EQU	12	LE common anchor area address
	R13	EQU	13	Dynamic Storage Area address
	R14	EQU	14	Return point address
	R15	EQU	15	Entry point address
	INVUTIL	CEEENTRY AUTO-DSASIZE,						x
				MAIN=YES,						x
				EPA-INVEPA,					x
				BASE=R10
			USING	CEECAA,R12	LE CAA addressability
			USING	CEEDSA,R13	Dynamic Data addressability
	*
	*		Tell them we are here
	*
			WTO	'IDXUTIL0001 Begin IDXUTIL Program'
			B	OPENLST
			DC	CL8'IDXUTIL'
			DC	CL8'&SYSDATE'
			DC	CL8'&SYSTIME'
	*
	*		Clear save area and open the input file
	*
	OPENLST	DS	0H
			MVI	RECSAVE,C' '
			MVC	RECSAVE+1(L'RECSAVE-1),RECSAVE
			OPEN	(RECIN,INPUT),MODE=31
			LTR	R15,R15		Was open successful
			BZ	OPENOUT		Yes open the output file
			WTO	'IDXUTIL0002 RECIN Open Error'
			B	EORECIN		No. write msg and end
	*
	OPENOUT	DS	0H
			OPEN	(RECOUT,OUTPUT),MODE=31
			LTR	R15,R15		Successful output open
			BZ	INDXGET		Yes. read input file
			WTO	'IDXUTIL0003 RECOUT Open Error'
			B	EORECOUT
	*
	*		Read the input file
	*
	INDXGET	DS 	0H
			GET	RECIN,RECAREA
			CLC	RECAREA,RECSAVE	Is record a duplicate
			BE	INDXGET		Yes. skip it
			PUT	RECOUT,RECAREA	No. write it to output
			MVC	RECSAVE,RECAREA	then move to save area
			AP	RECCOUNT,=P'1'	+1 to output count
			B	INDXGET
	*
	*		All input records have been read
	*
	EORECOUT	DS	0H
			UNPK	REC#,RECCOUNT		Format counter
			OI	REC#+L'REC#-1,X'F0'
			MVC	RECMSG+54(8),REC#+7	Move count to msg
	RECMSG		WTO	'IDXUTIL0004 Unique Record/DSNAME combinations'			
	LRECMSG	EQU	*-RECMSG
			MVI	RECSAVE,C' '		Clear output area
			MVC	RECSAVE+1(L'RECSAVE=1),RECSAVE
			PUT	RECOUT,RECSAVE	Write a blank line no carr ctl
			MVC	RECSAVE(LRECMSG-10),RECMSG+8  as we will download
			PUT	RECOUT,RECSAVE	output to print on PC ptr
			WTO	'IDXUTIL0005 End IDXUTIL Program'
			CLOSE	RECOUT,MODE=31      	Close output file
	EORECIN	DS	0H
			CLOSE	RECIN			Close input file
			B	INDEXIT
	*
	*		Program Storage Areas
	*
	RECIN		DCB	DDNAME=RECIN,DSORG=PS,EODAD=EORECOUT,MACRO=(GM)
	RECOUT		DCB	DDNAME=RECOUT,DSORG=PS,MACRF=(PM)
			DC	CL8'RECAREA'
	RECAREA	DS	CL80' '	Record input/output area
			DC	CL8'RECSAVE'	Record save area
	RECSAVE	DS	CL80' '
	RECCOUNT	DC	PL8' '		Number of output records
	REC#		DC	CL15'12345678901234'
	*
	*		Return control to the operating system
	*	
	INDEXIT	DS	0H
			LR	R2,R15
			LA	R2,0(,R2)
			CEETERM RC=((R2))  	Return code register
			LTORG
			EJECT
	INVPPA		CEEPPA	,		LE required macros
			EJECT
			CEEDSA			Dynamic Save Area
	DSASIZE	EQU	*-CEEDSA
			EJECT
			CEECAA
			END	IDXUTIL

	*
	*		A CEEUOPTS LE macro was also assembled and linked
	*		as an LE user options load module.  CEEUOPTS was then 
	*		linked into the above load module in order to produce 
	*		a dump if the program abended.  The LE default does not
	*		produce a dump when a program abends.
	*