Blogs

How to use DB2 Call by using easytrive?

PARM DB2SSID('XXXX')
*----------------------------------------------------------------
*
FILE XXXXOUT FB (080 0)
OU_XXXXXX 01 080 A
OU_XXX 01 5 A
FILLER1 06 1 A
OU_XXX1 07 9 A
FILLER2 16 1 A
OU_XXX2 17 9 A
FILLER3 26 1 A
*** WORKING STORAGE***
WS_XXX_XXX W 5 A
WS_XXX_XXX1 W 9 P
WS_XXX_XXX2 W 9 P
*
WS-XXXXXX W 1 A VALUE 'Y'
*
*----------------------------------------------------------------
JOB INPUT SQL

SELECT +
XXX_XXX_XXX, +
XXX_XXX_XXX1, +
XXX_XXX_XXX2 +
FROM +
XXXX.XXXX_XXXX_XXXX +
ORDER BY +
XXX_XXX_XXX +
INTO +
:WS_XXX_XXX, +
:WS_XXX_XXX1, +
:WS_XXX_XXX2

IF WS-XXXXXX = 'Y'
OU_XXXXXX = W-XXXXXX
PUT FILEOUT
WS-SWITCH = 'N'
END-IF

PERFORM XXXX_DATA
PUT XXXXOUT

GOTO JOB

XXXX_DATA. PROC

OU_XXX_XXX = WS_XXX_XXX
OU_XXX_XXX1 = WS_XXX_XXX1
OU_XXX_XXX2 = WS_XXX_XXX2
FILLER1 = X'05'
FILLER2 = X'05'
FILLER3 = X'05'
FILLER4 = X'05'
FILLER5 = X'05'
FILLER6 = X'05'

END-PROC

How to read Database through input file by using easytrive?

The PSB needs to specify in program execute step like below.
//XXXX EXEC XXXXXXXX,PROG=XXXXXXX,PSB=XXXXXXXX
FILE HV01BPAA DLI(XXXXXXXX 1)
PCB-XXX-XXXX 1 8 A
PCB-XXXXXXX-XXXXX 9 2 A
PCB-STATUS-CODE 11 2 A
PCB-XXXX-XXXXXX 13 4 A
PCB-XXXXXXX-XXX 17 4 B
PCB-XXXXXXX-XXXX 21 8 A
PCB-XXXXXX-XXX-XX 29 4 B
PCB-XXX-XXXX-XXXXXXX 33 4 B
PCB-XXX-XX-XXXX 37 24 A
%XXXXXXXX
FILE INPFIL
XX-XXXX 1 50 A
XXXXXX 19 4 P 0

FILE OUTFILE
XXX-XXX 1 60 A
XXX-XXXX 1 8 N
*-----------------------------------------------*
* SSA-XXXX *
* ----------------------------------------------*
SSA-XXXXXXXX-QUAL W 26 A VALUE 'XXXXXXXX'
SSA-XXXXXXXX-LPA SSA-XXXXXXXX-QUAL +08 1 A VALUE '('
SSA-XXXXXXXX-XXX SSA-XXXXXXXX-QUAL +09 8 A VALUE 'XXXXXXXX'
SSA-XXXXXXXX-XXX SSA-XXXXXXXX-QUAL +17 2 A VALUE '= '
SSA-HV01SPA1-KEY SSA-XXXXXXXX-QUAL +19 6 A
SSA-XXXXXXXX-RPA SSA-XXXXXXXX-QUAL +25 1 A VALUE ')'
* ----------------------------------------------*
JOB INPUT FILEIN FINISH DISPLAY-CTR

PERFORM XXXXXXX-XXXX-XXXMENT
IF XXXX-XXXXXX-CODE = ' '
XXX-XXXX = DATABASE-XXXX
PUT OUTFILE
ELSE
DISPLAY 'XXXX-XXXXXX-CODE ' XXXX-XXXXXX-CODE
STOP
END-IF
*************************************************
GXXXXXX-XXXX-XXXMENT. PROC
*************************************************
FUNCTION = 'GU '
XXXXXXXX-XXXX-XX = XXXX-XX
CPRCSCPY-PROCESS-COMP = 11
SSA-XXXXXXXX-LPA = '('
SSA-XXXXXXXX-KEY = XXXXXXXX
SSA-COUNT = 1
DLI XXXXXXXX XXXXXXXX FUNCTION +
XXXXX XXX-XXXXX +
SSA (SSA-XXXXXXXX-QUAL)
XXXX-XXXXXX-CODE = PCB-STATUS-CODE
END-PROC

How to use Database Call by using easytrive?

The PSB needs to specify in program execute step like below.
//XXXX EXEC XXXXXXXX,PROG=XXXXXXX,PSB=XXXXXXXX

%XXXXXXXX – Record layout for database which you want to use
JOB INPUT (XXXXXXXX) – Database name
RETRIEVE XXXXXXXX +
SELECT (XXXXXXXX ID 'XX')
IF XXXX-XX = 'XX'
It read the database and record found in it.
END-IF

How to check in particular file had empty or not.

//*--------------------------------------------------------------------
//*STEP RETURN RC=12, IF FILE IN IS EMPTY.
//*--------------------------------------------------------------------
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...
//TOOLIN DD *
COUNT FROM(IN) EMPTY
/*

How to find the records count in particular file.

//CTRCDS EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=XXXXXXX.XXXXXX.XXXXXXXX.XXXX,DISP=SHR

//OUT DD DUMMY
//TOOLIN DD *
COUNT FROM(IN)
/*

COMPARE TWO FILES AND WRITE THE RECORDS THAT WERE NOT PRESENT IN FIRST FILE.

//*--------------------------------------------------------------------
//* COMPARES BOTH THE GDG AND WRITE THE RECORDS THAT ARE NOT PRESENT IN
//* GDG(-1) TO A PS.
//*--------------------------------------------------------------------
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...
GDG(-1) - FB/80
//IN2 DD DSN=...
GDG(0) - FB/80
//SORTOUT DD DSN=... OUTPUT FILE - FB/80
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(Starting position, till how much position you want to compare,
format of the key position values)
JOINKEYS F2=IN2,FIELDS=( Starting position, till how much position you want to compare,
format of the key position values)
JOIN UNPAIRED,F2,ONLY
OPTION COPY
/*

Syndicate content