You are on page 1of 9

NTERVIEW TOPICS (Utilities):

Utilities: 1) What is IDCAMS and when will it be used? IDCAMS is an access method services utility used for creating deleting altering !SAM files and co"ying se#uential file to a !SAM file etc$ %he different IDCAMS commands are as follows& o ALTER modifies information for a catalog alternate inde' cluster or "ath$ o BLDINDEX builds the alternate inde' of course$ o DEFINE is used for A(%)*+A%)I+D), C(-S%)* or .A%/$ o DELETE removes the catalog entry for a catalog cluster alternate inde' or "ath$ o LISTCAT lists information about the dataset$ o PRINT "rints the dataset contents$ o REPRO co"ies records from one file to another$ 0) What is I)12)+)* and when will it be used? I)12)+)* co"ies records from a se#uential dataset or creates a "artitioned dataset$ Some of the tas3s that I)12)+)* can "erform include the following& o o o o o Creating a bac3u" of a se#uential data set or a member of a .DS$ Changing the "hysical bloc3 si4e or logical record length of a se#uential data set$ Creating an edited data set$ .rinting a se#uential data set or a member of a .DS$ Creating "artitioned out"ut data set from se#uential in"ut data set$

An e'am"le of an I)12)+)* "rogram to co"y one dataset to another& //IEBGENER //STEP010 //SYSUT1 //SYSUT! // // //SYSPRINT //SYSIN JOB ACCT,'DATA COPY',MSGCLASS=J,CLASS=A EXEC PGM=IEBGENER DD DSN=xxxxx.yyyyy.zzzzz,DISP=S R DD DSN=""""".#####.$$$$$,DISP=%,CATLG&, UNIT=SYSDA,SPACE=%TR',%(,(&,RLSE&, DCB=%REC)M=)B,LRECL=1**0& DD SYSOUT=+ DD DUMMY

5or straight co"y tas3s the sort "rogram can often do these faster than I)12)+)*$

6n some systems it is "ossible to send email from a batch 7ob by directing the out"ut to the 8SMTP8 e'ternal writer$ 6n such systems the techni#ue is as follows& //IEBGENER JOB ACCT,'DATA COPY',MSGCLASS=J,CLASS=A //NORMRC EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=+ //SYSUT1 DD +,LRECL=,0 ELO -SYSTEMID.

MAIL )ROM/-USERID0SYSTEMID. RCPT TO/-USERID0SYSTEMID. DATA )1o2/ -USERID0SYSTEMID. To/ -USERID0SYSTEMID. S3#45$6/ T576 M"89 TEST MAIL )ROM MAIN)RAME . :UIT /+ //SYSUT! DD SYSOUT=%B,SMTP&,LRECL=,0 //SYSIN DD DUMMY 9) What is the S6*% utility and how is it being used? %he S6*%:M)*2) utility is "rogram to sort records in a file into a s"ecified order or merge "re;sorted files$ It is very fre#uently used< often the most commonly used a""lication "rogram in a mainframe sho"$ Modern sort:merge "rograms also can select or omit certain records summari4e records remove du"licates reformat records and "roduce sim"le re"orts$

Examples& ASSU PTIONS 1efore discussing about S6*% let us assume following things& In"ut file has following data and structure

INPUT FILE
JERSEY JERSEY DE<ILS PAC'ER RANGER RUTGER RUTGER PAC'ER !;*!;*!;*;*(;*;** 1;;*!;*(;*(;*(;*( ;*(;(;*(;!(;(*;!* =,;*>;,(;,(=;;=,> ?>(>(>,=>?=,>?>,( (0,;0=*,(;0,(=;*0 ;0*=(,*=(>!=;,*=( =,;*>;,(;,(=;;=,> 'NIC' EAGLES PAC'ER NETS GIANT LA'ER GIANT NETS

Sim"le S6*% =C( structure is as follows ; Sam"le sort =C( ;;;;


. . //STEP10 EXEC PGM=SORT,REGION=10!*',PARM=@"1"256517 //SYSOUT DD SYSOUT=+ O36@36 2577"A57 B1o2 SORT //SORTIN DD DSN=...,DISP=S R IC@36 8B SORT 15D3576 //SORTOUT DD DSN=... O36@36 Bo1 SORT 15D3576 //SORTO)xx DD DSN=... OUT)ILE o36@36 E"6" 7567 //SORTXSUM DD DSN=... O36@36 59828C"65E #y 6F5 SUM 762 //SORTG'CC DD UNIT=SYSDA, Go1H B8957 8B SORT 15D3576 //SYSIN DD + CoC61o9 76"6525C6 8C@36 E"6" 756 sort control statements /+ . .

56((6WI+2 A*) %/) SORTCARDS 56* DI55)*)+% %>.)S 65 S6*%S

TASK 1. SORT A GIVEN FILE - SAMPLE JCL


//SYSIN DD + SORT )IELDS=%1,;,C ,A,=,;,C ,A& /+

OUTPUT FILE
DE<ILS RUTGER RUTGER JERSEY JERSEY RANGER PAC'ER PAC'ER ;*(;(;*(;!(;(*;!* ;0*=(,*=(>!=;,*=( (0,;0=*,(;0,(=;*0 1;;*!;*(;*(;*(;*( !;*!;*!;*;*(;*;** ?>(>(>,=>?=,>?>,( =,;*>;,(;,(=;;=,> =,;*>;,(;,(=;;=,> PAC'ER GIANT LA'ER EAGLES 'NIC' GIANT NETS NETS

EXPLANATION Above synta' of S6*% sorted the records de"ends on 3eys we have "rovided ?we have "rovided two 3eys in 5I)(DS "arameter)$ 1st @)>& 1 9 C/ A ; first 3ey started at column 1 length is 9 0nd @)>& A 9 C/ A ; second 3ey started at column A length is 9 In the above e'am"le C/; means character we may use 1I for binary A ; Ascending order

TASK 2. ELIMINATE DUPLICATES

//SYSIN DD + SORT )IELDS=%1,;,C ,A& SUM )IELDS=NONE /+

OUTFILE
DE<ILS RUTGER JERSEY RANGER PAC'ER ;*(;(;*(;!(;(*;!* (0,;0=*,(;0,(=;*0 !;*!;*!;*;*(;*;** ?>(>(>,=>?=,>?>,( =,;*>;,(;,(=;;=,> PAC'ER LA'ER 'NIC' GIANT NETS

EXPLANATION If we give S-M 5I)(DSB+6+) it will eliminate du"licates$

TASK 3. SPLIT FILE INTO TWO OR THREE FILES DEPENDS ON CONDITIONS


. . . //SORTO)01 DD DSN=E"6"7561, // DISP=%NEG,CATLG,DELETE&,UNIT=SYSDA, // SPACE=%CYL,%1,*&,RLSE&, // DCB=%REC)M=)B,LRECL=,0,BL'SIIE=0& //SORTO)0! DD DSN=E"6"756!, // DISP=%NEG,CATLG,DELETE&,UNIT=SYSDA, // SPACE=%CYL,%1,*&,RLSE&, // DCB=%REC)M=)B,LRECL=,0,BL'SIIE=0& //SORTO)0; DD DSN=E"6"756;, // DISP=%NEG,CATLG,DELETE&,UNIT=SYSDA, // SPACE=%CYL,%1,*&,RLSE&, // DCB=%REC)M=)B,LRECL=,0,BL'SIIE=0& . . . //SYSIN DD + SORT )IELDS=COPY OUT)IL )ILES=01,INCLUDE=%1,?,C ,E:,C'JERSEY'& OUT)IL )ILES=0!,INCLUDE=%1,?,C ,E:,C'PAC'ER'& OUT)IL )ILES=0;,INCLUDE=%1,?,C ,E:,C'RUTGER'& /+

SORTOF01
JERSEY JERSEY !;*!;*!;*;*(;*;** 'NIC' 1;;*!;*(;*(;*(;*( EAGLES

SORTOF02
PAC'ER PAC'ER =,;*>;,(;,(=;;=,> NETS =,;*>;,(;,(=;;=,> NETS

SORTOF03
RUTGER RUTGER (0,;0=*,(;0,(=;*0 LA'ER ;0*=(,*=(>!=;,*=( GIANT

EXPLANATION 1$ S6*% 5I)(DSBC6.> ; use this for co"ying of records not for sort$ 0$ 6-%5I( 5I()SBC1 I+C(-D)B?1 D C/ )E CF=)*S)>F) 6-%5I( 5I()SBC0 I+C(-D)B?1 D C/ )E CF.AC@)*F) 6-%5I( 5I()SBC9 I+C(-D)B?1 D C/ )E CF*-%2)*F) S>+CS6*% will ta3e data from 1st "osition to Dth "osition of in"ut file and it will com"are that data with =)*S)> or .AC@)* or *-%2)* If data e#uals to =)*S)> then that record will co"ies to dataset defined in S6*%65C1 ste"$ ?because we defined 5I()SBC1 in second condition) If data e#uals to .AC@)* then that record will "ass to dataset defined in S6*%65C0 ste"$ ?because we defined 5I()SBC0 in second condition ) If data e#uals to *-%2)* then that record will co"ied to dataset defined in S6*%65C9 ste"$ ?because we defined 5I()SBC9 in third condition )

TASK 4. COPY ELIMINATED DUPLICATES INTO ANOTHER FILE - SAMPLE JCL


. . //SORTXSUM DD DSN=E"6"756C"25, // DISP=%NEG,CATLG,DELETE&,UNIT=SYSDA, // SPACE=%CYL,%1,*&,RLSE&, // DCB=%REC)M=)B,LRECL=,0,BL'SIIE=,00& . . //SYSIN DD + SORT )IELDS=%1,;,C ,A& SUM )IELDS=NONE,XSUM /+

SORTOUT
DE<ILS RUTGER ;*(;(;*(;!(;(*;!* PAC'ER (0,;0=*,(;0,(=;*0 LA'ER

JERSEY RANGER PAC'ER

!;*!;*!;*;*(;*;** 'NIC' ?>(>(>,=>?=,>?>,( GIANT =,;*>;,(;,(=;;=,> NETS

SORTXSUM
RUTGER JERSEY PAC'ER ;0*=(,*=(>!=;,*=( GIANT 1;;*!;*(;*(;*(;*( EAGLES =,;*>;,(;,(=;;=,> NETS

EXPLANATION 1$ S6*% 5I)(DSB?1 9 C/ A) In"ut file will be sorted de"ending u" on the 3ey s"ecified above 1 9 C/ A ; 3ey starting "osition is 1 and length 9 com"aring ty"e character sorting is don in ascending order$ 0$ S-M 5I)(DSB+6+) ,S-M S-M 5I)(DSB+6+) means it will eliminate du"licates$ ,S-M o"tions will co"y all records eliminated in the sort "rocess and will co"y to another data set defined in S6*%,S-M ste".

TASK . COPY RECORDS DEPENDING UPON CONDITION


//SYSIN DD + SORT )IELDS=COPY INCLUDE COND=%1,?,C ,E:,C'PAC'ER'& /+

OUTPUTFILE
PAC'ER PAC'ER =,;*>;,(;,(=;;=,> NETS =,;*>;,(;,(=;;=,> NETS

EXPLANATION Above card is to co"y records from in"ut file which contains .AC@)* at 1st "osition$

TASK !. FORMATING A FILE "USING INREC#


//SYSIN DD + SORT )IELDS=COPY INREC )IELDS=%>/!,(,!0/10,;& /+

OUTPUT FILE
O AN' O AN' RAMES URES AMES RIS N RIS N URES EXPLANATION 1$ S6*% 5I)(DSBC6.> It is for co"ying records to out"ut file$ 0$ I+*)C 5I)(DSB?G&0 H 0C&1C 9) ?for formatting) %he two formatting o"tions are& o o G&0 H ; data at 0nd "osition of in"ut file with length H will be co"ied to the Gth "osition of out"ut file$ 0C&1C 9 ; data at 1Cth "osition of in"ut file with length 9 will be co"ied to 0Cth "osition of out"ut file$ ;*!" ;;* *(; ,;* >(> 0,; 0*= ,;*

In above e'am"le we can use 6-%*)C instead of I+*)C$ o o I+*)C adds deletes or reformats fields before the records are sorted or merged hence "erformance will im"roved$ 6-%*)C adds deletes or reformats fields after the records are sorted or merged$

O$%&' ()')*&$&'+ ,& -). ()++ ,/$% +0'$ -)'1


SKIPREC=n $"3757 7o16 6o 7H8@ oJ51 'C' 15$o1E7 8C 6F5 8C@36 B895 #5Bo15 76"168CA " 7o168CA o1 $o@y8CA o@51"68oC. STOPAFT=n $"3757 7o16 6o 76o@ "B651 'C' 15$o1E7 8C 6F5 8C@36 B895 F"J5 #55C 7o165E o1 $o@85E. I) -sing S6*% utility how do you convert !1 files to 51? Sam"le =C( for converting !ariable;1loc3ed files to 5i'ed;1loc3ed$ N!te& this =C( is used to transform an in"ut file with !1 ICCC to an out"ut file with 51 JC$ ::S6*% ),)C .2MBIC)MA+ *)2I6+BICAD@ ::S>S6-% DD S>S6-%BK

::S>S.*I+% DD S>S6-%BK ::S6*%W@C1 DD S.AC)B?C>( ?9 9)) -+I%BS>S%S ::S6*%W@C0 DD S.AC)B?C>( ?9 9)) -+I%BS>S%S ::S6*%W@C9 DD S.AC)B?C>( ?9 9)) -+I%BS>S%S ::S6*%I+ DD DS+B.H0H90J$S.-5I$6-% DIS.BS/* ::515I() DD DS+B.H0H90J$S.-5I$51JC :: S.AC)B?C>( ?1 1) *(S)) -+I%BS>S%S :: DC1B?*)C5MB51 (*)C(BJC 1(@SIL)BJCCC) :: DIS.B?+)W CA%(2 CA%(2) ::S>SI+ DD K 6.%I6+ C6.> !(S/*% 6-%5I( 5+AM)SB515I() 6-%*)CB?1&H JC) C6+!)*% ::K ),.(A+A%I6+ o o o o 6.%I6+ C6.> indicates that records will be co"ied to out"ut file$ 6.%I6+ !(S/*% indicates that missing control filed bytes will be re"lace with binary 4eroes$ 515I() is the ddname of the out"ut file 6-%*)C "arams are as follows& 1 B start "osition of in"ut file H B relative start "osition for the out"ut file ?i$e$ & here we s3i" the length bytes of the !1 format) JC B length of data transferred to the out"ut file$ It must match the (*)C( of the out"ut file$

H) What is !(S/*% o"tion in S6*%? 1ecause !1 records have a fi'ed "art and a variable "art it is "ossible for "art of a control field to be missing$ Consider this S6*% statement& S6*% )IELDS=%!1,1!,C ,A& %he control field is in "ositions 01;90$ If your !1 records have 0H fi'ed data bytes and (*)C(BIH the records can vary in length from 0A bytes ?I;byte *DW 0H bytes of fi'ed data and C bytes of variable data) to IH bytes ?I;byte *DW 0H bytes of fi'ed data and 1D bytes of variable data)$ *ecords 90 bytes or longer include the entire control field$ 1ut records less than 90 bytes have 8short8 control fields that is they are missing some of the bytes at the end of the control field$ >ou cannot validly sort or merge on control fields with missing bytes because missing bytes have no values$

If you 3now you have !1 records with short control fields you can s"ecify the !(S/*% o"tion if a""ro"riate to "revent D5S6*% from terminating$ 5or e'am"le& 6.%I6+ <LS RT S6*% )IELDS=%!1,1!,C ,A&

!(S/*% tells D5S6*% that you want to tem"orarily re"lace any missing control field bytes with binary 4eros ?the 4eros are not 3e"t for the out"ut record) thus allowing D5S6*% to validly sort or merge on the short control fields$

Attention& If +6!(S/*% is in effect D5S6*% terminates if it finds a short control field in any !1 record$

6)

You might also like