Tuesday, September 18, 2007

Dinosaurs - Build records without a program

The topic for this week's discussion is the utility IEBDG . I did not know about this utility for long. We had to build millions of records to volume test an application . I always hate to write a program as it takes time to construct and test it(still might have some errors). I looked for an Utility that could build records without any input and IEBDG helped me out

To illustrate, below is an example code that builds 100 different records without any input

JCL
//IEBDG EXEC PGM=IEBDG
//SYSPRINT DD SYSOUT=*
//SEQOUT DD DSN=ADCF74C.SUN.SORTTEST,DISP=(CATLG,DELETE), <>
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),DCB=(RECFM=FB,LRECL=170,BLKSIZE=0)
//SYSIN DD *
DSD OUTPUT=(SEQOUT)
FD NAME=F1,LENGTH=10,STARTLOC=1,FORMAT=ZD,INDEX=5
FD NAME=F2,LENGTH=1,STARTLOC=12,FORMAT=AL,ACTION=RP
FD NAME=F3,LENGTH=10,STARTLOC=22,PICTURE=6,'SAMPLE',FILL=X'40'
CREATE QUANTITY=100,NAME=(F1,F2,F3),FILL=X'40'
END
/*

Output
0000000001 A SAMPLE
0000000006 B SAMPLE
0000000011 C SAMPLE
0000000016 D SAMPLE
0000000021 E SAMPLE
0000000026 F SAMPLE
0000000031 G SAMPLE
0000000036 H SAMPLE
0000000041 I SAMPLE
0000000046 J SAMPLE


Comments
Let me explain the Sysin statements here

DSD statement should be the first line and it should contain the definition of the Input/Output files defined in the JCL. In this example we just have one output file defined by DD name SEQOUT

FD indicates field definition.
FD NAME=F1,LENGTH=10,STARTLOC=1,FORMAT=ZD,INDEX=5
The above statement means Define field F1 of length 10 ,the starting location of this field in the output file is 1 and the format is a zoned decimal. Increment this field by 5(Index = 5)

FD NAME=F2,LENGTH=10,STARTLOC=12,FORMAT=AL,ACTION=RP
The above statement means Define field F2 of length 1 ,the starting location of this field in the output file is 12 and the format is alpha. Increment this field in every record

FD NAME=F3,LENGTH=10,STARTLOC=22,PICTURE=6,'SAMPLE',FILL=X'40'
The above statement means Define field F3 of length 10 ,the starting location of this field in the output file is 22 and it is a string"SAMPLE" of fixed length

CREATE QUANTITY=100,NAME=(F1,F2,F3),FILL=X'40'
Create statement actually creates the records using the fields defined above. The " FILL=X'40' " indicates any unused bytes in the file to be filled with spaces. The QUANTITY=100 indicates number of records to be created


Sometime you might have to build a master file with LRECL say 1000. In this case you may not be able to define each and every field.

For example you have a master file which is 100 bytes in length. You want to build say 10,000 records , but you may just want a unique Account number in each records and all the other fields in the record can have the same data. In this case we can use a template record with all the fields defined except account number . We can use this record to generate 100 records with different account numbers alone

Example
Template record
xxx ABCD

Your required output
001 ABCD
002 ABCD
.
.
..
100 ABCD

JCL
//IEBDG EXEC PGM=IEBDG
//SYSPRINT DD SYSOUT=*
//IN1 DD DSN=ADCF74C.SUN.SORTTEST,DISP=SHR <