Assembly code

Manish Lall

Assembly code
Hello,

Can any body send me an assembly program which has static sql embedded
in it.
We have seen the code of DSNTIAD and DSNTIAUL , but anything beyond that
.

Thanks in advance ,
Manish



Georg Peter

AW: Assembly code
(in response to Manish Lall)
Manish,

I assume you are searching an assembler program with embedded SQL. Below is
an excellent example that I have received from ISAAC YASSIN some time
ago...........

MEMBER TMSTMP
==================
TITLE 'SQL PROGRAM'
**********************************************************************
* WRITTEN BY: ISAAC YASSIN (C) - 1993. *
**********************************************************************
*
DSNTIACN
*
EJECT
*
**********************************************************************
* INITIALIZE DATA BEFORE PROCESSING, HOUSEKEEPING *
**********************************************************************
*
TMSTMP CSECT CONTROL SECTION NAME
SAVE (14,12) ANY SAVE SEQUENCE
LR R12,R15 CODE ADDRESSABILITY
USING TMSTMP,R12 TELL THE ASSEMBLER
*
L R5,4(,R1) R5 ON OUTPUT PARMS ADDRESS
ST R5,OUTADDR OUTPUT AREA ADDRESS
L R6,PROGSIZ GET SPACE FOR USER PROGRAM
A R6,SQLDSIZ GET SPACE FOR SQLDSECT
GETMAIN R,LV=(6) GET STORAGE FOR PROGRAM VARIABLES
*
LR R10,R1 POINT TO IT
LR R2,R10 POINT TO THE FIELD
LR R3,R6 GET ITS LENGTH
SR R4,R4 CLEAR THE INPUT ADDRESS
SR R5,R5 CLEAR THE INPUT LENGTH
MVCL R2,R4 CLEAR OUT THE FIELD
*
ST R13,FOUR(R10) CHAIN THE SAVEAREA PTRS
ST R10,EIGHT(R13) CHAIN SAVEAREA FORWARD
LR R13,R10 POINT TO THE SAVEAREA
USING PROGAREA,R13 SET ADDRESSABILITY
*
LR R9,R13 POINT TO THE PROGAREA
A R9,PROGSIZ THEN PAST TO THE SQLDSECT
USING SQLDSECT,R9 SET ADDRESSABILITY
ST R6,GETLENTH SAVE THE LENGTH OF THE GETMAIN
*
B OPENFILE START WORKING
*
DC CL8'&SYSDATE'
DC CL8'&SYSTIME'
**********************************************************************
* CONSTANTS *
**********************************************************************
*
TMSTP DC CL26' ' TIMESTAMP
DC CL8' OUTPTR:'
OUTADDR DS F OUTPUT ADDRESS (R1 OF ENTRY)
**********************************************************************
* SET UP FOR READING *
**********************************************************************
CNOP 0,4
OPENFILE EQU *
* B QUIT
**********************************************************************
* SELECT *
**********************************************************************
EXEC SQL +
SELECT CURRENT TIMESTAMP +
INTO :TMSTP +
FROM SYSIBM.SYSDATABASE +
WHERE NAME = 'DSNDB06 '
*
********************************************************************
* FREE THE GOTTEN STORAGE AND EXIT
********************************************************************
*
QUIT EQU *
L R5,OUTADDR R5 ON OUTPUT AREA-SAPIENS NEEDS R5
MVC 2(26,R5),TMSTP R5 POINTS TO OUTPUT AREA
*
L R0,GETLENTH GET LENGTH OF GOTTEN STORAGE
LR R1,R13 POINT TO THE AREA
LH R2,RETCODE GET RETURN CODE
L R13,FOUR(R13) POINT TO MY SAVE AREA
ST R2,SIXTEEN(R13) PUT RETURN CODE INTO SAVE AREA
*
FREEMAIN R,LV=(0),A=(1) FREE THE GOTTEN STORAGE
* ABEND 888,DUMP
*
RETURN (14,12),T AND RETURN
EJECT
LTORG
**********************************************************************
* DECLARE VARIABLES, WORK AREAS *
**********************************************************************
PROGAREA DSECT WORKING STORAGE FOR THE PROGRAM
SAVEHDR DC CL8'SAVEAREA' EYECATCHER
SAVEAREA DS 18F SAVEAREA FOR USE BY CALLED RTNS
RETCODE DS H'0' RETURN CODE VALUE = 0 (DEFAULT)
GETLENTH DS A GETMAIN LENGTH FOR THIS AREA
DATAADDR DS A ADDRESS OF DATA
*
**********************************************************************
* DEFINE SQL COMMUNICATION AREA
**********************************************************************
*
EXEC SQL INCLUDE SQLCA
*
CNOP 0,4
*
DS 0D
PROGSIZE EQU *-PROGAREA DYNAMIC WORKAREA SIZE
TMSTMP CSECT RETURN TO CSECT FOR CONSTANT
PROGSIZ DC A(PROGSIZE) SIZE OF PROGRAM WORKING STORAGE
END
++++++++++++++++++


Hope that was it what you are looking for..................

With kind regards - mit freundlichen Grüssen,
G e o r g H . P e t e r
DB2 Data Base Administrator c/o
-------------------------------------------------------------------
Datenzentrale Baden-Wuerttemberg
Technology & Development Center
Knowlegde Center Database Systems
Krailenshaldenstrasse 44, 70469 Stuttgart, Germany
e:mail [login to unmask email]
Phone 0049-711-8108-271
PC-Fax 004971189696071
Internet (only in german language):http://www.dzbw.de
----------------------------------------------------------------------

"Experience is something you don't get until after you need it." -
Anonymous