Wednesday, March 11, 2009

How to analysis CEEDUMP from entry offset

We usually get a error in SYSOUT at run time like "From compile unit CHR09 at entry point CHR09 at compile unit offset +000004AC at entry offset +000004AC at address 37900FBC."
1. first step get the error message from +000004AC, if you didn't have SYSOUT, you also could get it from CEEDUMP file, search "Traceback" in the file, find the value of "PU Offset" after Traceback like following:
Traceback:
DSA Program PU PU Entry
Addr Unit Addr Offset
3798E158 CEEHDSP 153541C0 +000049D6 CEEHDSP
3798E030 CHR09 37900B10 +000004AC CHR09

2. Try to find the nearest lower line number from the compling list with "PU Offset".
LINE # HEXLOC VERB LINE # HEXLOC VERB
000025 00048A MOVE 000026 000490 INSPECT
000031 00052E MOVE 000032 000584 MOVE


Then you could find the statement line num in the source code.

COBOL INSPECT

1. Inspect statement, Note must initiate the Count field before using it, which cannot automatically set to zero.
01 COUNT-FIELD PIC S999 SIGN LEADING SEPARATE.

INSPECT WORK-FIELD TALLYING
COUNT-FIELD FOR CHARACTERS.

Wednesday, February 18, 2009

DSNTIAUL Unload table with SQLs

SQLs specified in SYSIN...
UNLOAD card generated in SSPUNCH
SQLs result saved in SYSREC00 with wild format.
Attention to the SQLs result type, if you use expression or function.
eg.
SELECT '03',ACCT_YR FROM owner.table1
'03' string will be treated as VARCHAR(2), will occupied 4 bytes in the unload file.
=============================================================


//UNLOAD EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(DSN) RUN PROGRAM(DSNTIAUL) PLAN(DSNTIB81) -
LIB(’DSN810.RUNLIB.LOAD’)
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSREC00 DD DSN=DSN8UNLD.SYSREC00,
// UNIT=SYSDA,SPACE=(32760,(1000,500)),DISP=(,CATLG),
// VOL=SER=SCR03
//SYSPUNCH DD DSN=DSN8UNLD.SYSPUNCH,
// UNIT=SYSDA,SPACE=(800,(15,15)),DISP=(,CATLG),
// VOL=SER=SCR03,RECFM=FB,LRECL=120,BLKSIZE=1200
//SYSIN DD *
DSN8810.PROJ WHERE DEPTNO='D01'

Wednesday, February 11, 2009

Remove BK files for DB2

when you deleting bk files for Database, don't forget to deleting Backup records in SYSIBM.SYSCOPY tables.

//*********************************************************************
//*THE MODIFY UTILITY WITH THE RECOVERY OPTION DELETES RECORDS FROM THE
//*SYSIBM.SYSCOPY CATALOG TABLE, RELATED LOG RECORDS FROM THE
//*SYSIBM.SYSLGRNX DIRECTORY TABLE, AND ENTRIES FROM THE DBD, AND
//*RECYCLES DB2? VERSION NUMBERS FOR REUSE.
//*********************************************************************
//UTILSTEP EXEC PGM=DSNUTILB,
// PARM=(D61A,FMSTHP,''),
// TIME=1440,REGION=0M
//STEPLIB DD DSN=DSN810.SDSNLOAD,DISP=SHR
//DSNTRACE DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSUT1 DD UNIT=(SYSDA,1),SPACE=(CYL,10)
//*DELETING SYSCOPY AND SYSLGRNX RECORDS THAT ARE OVER A CERTAIN AGE
//SYSIN DD *
MODIFY RECOVERY TABLESPACE DSN8D91A.DSN8S91E DELETE AGE(90)
/*
//

Thursday, February 5, 2009

Change Special Resource

The following code is used to change SR to Unavailable.

//JOBxxx JOB ...
// SET OUTP=*
//*----------------------------------------
//* CHANGE SPECIAL RESOURCE TO UNAVAILABLE
//*----------------------------------------
//*
//STEP010 EXEC PGM=EQQEVPGM
//EQQMLIB DD DISP=SHR,DSN=EQQ.SEQQMSG0
//EQQMLOG DD SYSOUT=&OUTP
//SYSUDUMP DD SYSOUT=&OUTP
//SYSPRINT DD SYSOUT=&OUTP
//SYSIN DD *
SRSTAT 'SR.SR01' AVAIL(NO) SUBSYS(OPCx)
//

Tuesday, January 13, 2009

Error and Condition Trapping (Call ON versus Signal ON)

Call ON and OFF is used to handle condition trap by procedure name.
SynTax:
call ON conditionName [ NAME trapLabel ] 
call OFF condition-Name

signal ON conditionName [ NAME trapLabel ] 
signal OFF condition-Name

Overview when Exception occurs Control is transferred to routine to address the errors. After the error routine handles the condition, execution of primary script can resume.

The difference between call and signal:
1. signal applies to all seven error conditions. call didn't apply to SYNTAX,NOVALUE,and LOSTDIGITS errors.
    note: other error conditions: HALT,ERROR,FAILURE,NOTREADY
2. signal forces abnormal changes in the flow of control, and unconditionally transfer the control to the trapLabel, after processed, [and then transferred the control to a specified Label manually].
   call provides a "normal" way to trap routines, control is automatically transferred from the error routine back to main program, and the result special variable is not setting when returned from a condition trap, any value coded on the return will be ignored.



Wednesday, January 7, 2009

UTIL DSNUTILB

DSNUTILB specifies a utility control program, it can be used for checks, reorg, image copys, load and so on.

Project CASE:
Scenario:
For there are several testing environment needed for several level testing, like UT, FT, ST, UAT..., so data preparation is usually a wasting-time task after environment setup.
Request:
Loading and initializing a new environment by copying an existing environment rather than creating an environment by migration and conversion is required.

1. unload the files from tables in the old env.
2. transfer the files to the new env. (change the name according to the new env.)
3. Load the received files into the tables in new env.

unload PROC:
000001 //TBLUNLD PROC TBSP=,SIZE=0M
000002 //*
000003 //*********************************************************************
000004 //* STEP DELETE: DELETE OLD DATASETS
000005 //*********************************************************************
000006 //STEP010 EXEC PGM=IEFBR14,COND=(4,LT)
000007 //SYSREC DD DSN=OLD.UNLOAD.FILE,
000008 // UNIT=SYSDA,DISP=(MOD,DELETE,DELETE),SPACE=(TRK,1)
000009 //*********************************************************************
000010 //* STEP UNLOAD: UNLOAD TABLES
000011 //*********************************************************************
000012 //UNLOAD EXEC PGM=DSNUTILB,REGION=&SIZE,COND=(4,LT),
000013 // PARM='&DB2SYS,&ENVID.&TBSP,&UTPROC'
000014 //STEPLIB DD DSN=&DB2LOAD,DISP=SHR
000015 //SYSPRINT DD SYSOUT=&OUTP
000016 //UTPRINT DD SYSOUT=&OUTP
000017 //SYSUDUMP DD SYSOUT=&OUTD
000018 //SYSPUNCH DD DSN=Unload.card.lib(LOD&TBSP.),
000019 // DISP=SHR
000020 //SYSREC DD DSN=Unload.file,
000021 // DISP=(,CATLG,DELETE),
000022 // DCB=(BLKSIZE=8192),
000023 // SPACE=(CYL,(50,500),RLSE),
000024 // UNIT=(3390,6)
000025 //SYSIN DD DSN=unload.card,DISP=(OLD,DELETE)
Unload card layout:
000001 UNLOAD TABLESPACE &DB..&TBSP FROM TABLE
000002 &OWNER..&TBNAME
000003 HEADER NONE
Unload job layout:
000001 //DMRUDAC1 JOB (ACCT#,ACCT-INFO),'PROGRAMMER',
000002 //  MSGCLASS=X,TIME=1440,REGION=0M
000003 // JCLLIB ORDER=(Lib01)
000004 //*
000005 //FMSSYM INCLUDE MEMBER=emv#SYM
000006 //*
000007 // SET ENVID=&LVL2
000008 //*********************************************************************
000009 //* THIS JOB SHOULD ONLY BE RUN : *
000010 //* ============================= *
000011 //* - IN THE SOURCE(OLD) ENVIRONMENT *
000012 //* *
000013 //*********************************************************************
000014 //* I UNLOAD FMS ACHIEVEMENT TABLES, JOBS FMSUD### CAN RUN *
000015 //* SIMULTANEOUSLY *
000016 //*********************************************************************
000017 //* RERUN : YES *
000018 //* STEP RESTART : FROM THE FAILED STEP *
000019 //*********************************************************************
000020 //*
000021 //*********************************************************************
000022 //* CHANGE HISTORY *
000023 //*-------------------------------------------------------------------*
000024 //* DATE   | REQ#   |BY  | STEP  | DDNAME |COMMENTS *
000025 //*--------|--------|----|-------|--------|---------------------------*
000026 //*        |        |    |       |        |- INITIAL VERSION *
000027 //*********************************************************************
000028 //*
000029 //*--------------------------------------------------------------------
000030 //* UNLOAD ACH-1
000031 //FMSBFE EXEC FMSUNLD,DB=DB01,TBSP=SPACE1,TBN='TABLE_01'
Load PROC
000001 //DB2LOAD JOB (ACCT#,ACCT-INFO),'PRG-NM',
000002 // MSGCLASS=X,NOTIFY=USERID,USER=USERID,
000003 // TIME=1440,REGION=0M
000004 //* LOAD TABLE 
000005 //*--------------------------------------------------------------------*
000006 //* **************************************************** *
000007 //* * CHANGE THE DB2 UTIL NAME BELOW * *
000008 //* **************************************************** *
000009 //* 
000010 //DSNUPROC PROC LIB=’DSN.SSPGM’,SYSTEM=DSN,UID=’’,UTPROC=’’
000011 //DSNUPROC EXEC PGM=DSNUTILB,REGION=0M,
000012 // PARM=(&SYSTEM,&UID,&UTPROC)
000013 //STEPLIB DD DSN=&LIB,DISP=SHR
000014 //SYSPRINT DD SYSOUT=*
000015 //UTPRINT DD SYSOUT=*
000016 //SYSUDUMP DD SYSOUT=*
000017 //SYSERR DD DSN=&&SYSERR,DISP=(MOD,DELETE),
000018 // SPACE=(CYL,(100,100),RLSE),UNIT=(3390,1)
000019 //SYSMAP DD DSN=&&SYSMAP,DISP=(MOD,DELETE),
000020 // SPACE=(CYL,(100,100),,,ROUND),UNIT=(3390,1)
000021 //SYSDISC DD DUMMY
000022 //SYSUT1 DD DSN=&&SYSUT1,UNIT=(3390,24),
000023 // DISP=(MOD,PASS),
000024 // SPACE=(CYL,(200,200),,,ROUND)
000025 //SORTOUT DD DSN=&&SORTOUT,UNIT=(3390,24),
000026 // DISP=(MOD,PASS),
000027 // SPACE=(CYL,(200,200),,,ROUND)
000028 //* **************************************************** *
000029 //* * THE SYSREC IS THE UNLD DATASET * *
000030 //* * THE SYSIN IS THE CNTL DATASET *
000031 //* * (CAN BE GENERATED WHILE UNLOAD) *
000032 //* **************************************************** *
000033 //SYSREC DD DUMMY,DISP=SHR
000034 //SYSIN DD DSN=DUMMY,
000035 // DISP=SHR
000036 // PEND 
000037 //* TABLE_01
000038 //STEP010 EXEC DSNUPROC
000039 //DSNUPROC.SYSREC DD DSN=unloaddsn
000040 // ,DISP=SHR
000041 //DSNUPROC.SYSIN DD DSN=loadcard_01
000042 // ,DISP=SHR
the above utility is used to load SYSREC file to table TABLE_01 with load card Loadcar_01,the following is the layout of load card for TABLE_01,pay attention to INDDN SYSREC and REPLACE ...
Load Card:
000001 LOAD DATA INDDN SYSREC LOG NO DISCARDS 1 REPLACE
000002 UNICODE CCSID(00367,01208,01200)
000003 INTO TABLE "DB2Scham1"."TABLE_01"
000004 ( 
000005 "ACCT_YR"
000006 POSITION( 00001:00004 ) CHAR (004)
000007 ,"ACCT_MTH"
000008 POSITION( 00005:00006 ) CHAR (002)
000009 ,"USERID_LOCK"
000010 POSITION( 00007:00014 ) CHAR (008)
000011 ,"LAST_UPT_CTY"
000012 POSITION( 00015:00017 ) CHAR (003)
000013 ,"LAST_UPT_ID"
000014 POSITION( 00018:00025 ) CHAR (008)
000015 ,"LAST_UPT_TIME"
000016 POSITION( 00026:00051 ) TIMESTAMP EXTERNAL
000017 
000018 ) 
000019 REPAIR OBJECT LOG NO
000020 SET TABLESPACE FMSDFP1.FMSSOYR
000021 NOCOPYPEND