Pages

Wednesday, 14 May 2014

Mainframe PL/1 - Video Trainings


DFSORT - SPLIT,SPLITT1R And SPLITBY - Difference

These are some basic differences. Reference is IBM.

SPLIT = It splits input records evenly into output files

Example:
OPTION COPY
  OUTFIL FNAMES=(OUTPUT1,OUTPUT2),SPLIT
With 17 input records, the results produced for OUTPUT1 are:
Record 01
Record 03
Record 05
Record 07
Record 09
Record 11
Record 13
Record 15
Record 17
The results produced for OUTPUT2 are:
Record 02
Record 04
Record 06
Record 08
Record 10
Record 12
Record 14
Record 16

SPLITBY = n == >It splits records 'n' at a time to output datasets

Example:
 OPTION COPY
  OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLITBY=4
With 17 input records, the results produced for OUT1 are:
Record 01
Record 02
Record 03
Record 04
Record 13
Record 14
Record 15
Record 16
The results produced for OUT2 are:
Record 05
Record 06
Record 07
Record 08
Record 17
The results produced for OUT3 are:
Record 09
Record 10
Record 11
Record 12

SPLIT1R = n => It splits records of 'n' to output dataset. The remaining records it writes to last file.

Example:
OPTION COPY
   OUTFIL FNAMES=(OUTA,OUTB,OUTC),SPLIT1R=5 
With 17 input records, the results produced for OUTA are:
Record 01 
Record 02 
Record 03 
Record 04 
Record 05
The results produced for OUTB are:
Record 06 
Record 07 
Record 08 
Record 09 
Record 10
The results produced for OUTC are:
Record 11 
Record 12 
Record 13 
Record 14 
Record 15 
Record 16 
Record 17

Monday, 12 May 2014

DFSORT ALTSEQ, END, RECORD And SUM

directfix.comThe below are the descriptions for some of the key functions in SORT:

ALTSEQ: Specifies changes to the ALTSEQ translation table to be used for SORT, MERGE, INCLUDE or OMIT fields with format AQ, for INREC, OUTREC, and OUTFIL fields with TRAN=ALTSEQ, and for INREC, OUTREC, and OUTFIL WHEN=(logexp) fields with format AQ.

DEBUG: Specifies various diagnostic options.

END: Causes DFSORT to discontinue reading SYSIN, SORTCNTL, or DFSPARM.

MODS: Specifies use of one or more user exit routines in a DFSORT application.

RECORD: Can be used to supply length and type information.

SUM: Specifies that numeric summary fields in records with equal control fields are summed in one record and that the other records are deleted.

Thursday, 8 May 2014

DFSORT OMIT, SUM AND OUTREC FIELDS - Best Tips

The below best example shows important key words of OMIT, SUM and OUTREC FIELDS.

//EXAMP    JOB B200,PROGRAMMER                                  
//STEP1    EXEC PGM=SORT                                        
//SYSOUT   DD SYSOUT=H                                          
//SORTIN   DD DSN=INP1,DISP=SHR,UNIT=3380,VOL=SER=SCR001        
//         DD DSN=INP2,DISP=SHR,UNIT=3390,VOL=SER=SYS351        
//SORTOUT  DD DSN=&&OUTPUT,DISP=(,PASS),UNIT=3390,              
//   SPACE=(CYL,(5,1)),DCB=(LRECL=22)                           
//SYSIN    DD *                                                 
  OMIT COND=(5,1,CH,EQ,C'M')                                    
  SORT FIELDS=(20,8,CH,A,10,3,FI,D)                             
  SUM FIELDS=(16,4,ZD)                                          
  OPTION DYNALLOC,ZDPRINT                                       
  OUTREC FIELDS=(10,3,20,8,16,4,2Z,5,1,C' SUM')
/*  


SUM : Whenever two fields of same encounterd, the SUM filed add the two fields and make it as one record

OMIT : It simply omits records in the o/p file

OUTREC FIELDS:  It reformat the o/p record

Friday, 2 May 2014

DFSORT INCLUDE AND COND

The below sort card helps how to show Include and Cond. 

DFSORT INCLUDE AND COND

Best Sort card

Ex:1

//MATCH EXEC PGM=SORT
//IN1 DD DSN=... input File1 (FB/10)
//IN2 DD DSN=... input File2 (FB/10)
//SORTOUT  DD SYSOUT=*  ...without duplicate records
 //SYSIN DD *
  INCLUDE FORMAT=BI, COND=(5,4,LT,11,4,OR,21,4,EQ,31,4,OR, 61,20,SS,EQ,C’FLY’)      OUTFIL INCLUDE=(5,4,BI,LT,11,4,BI,OR,21,4,BI,EQ,31,4,BI,OR, 61,20,SS,EQ,C’FLY’)
 /*


INCLUDE with COND => Applies only on input data set
OUTFIL INCLUDE => It applies on output dataset