Skip to main content

Posts

Showing posts from October, 2012

Featured

Space Explorers Book 7: Answers and Explanations

Memunic Space Explorers › Book 7: Memoon and the Search for Another Home › Answers and Explanations Answers and Explanations Habitable means life could live there; inhabited means life does live there. A world can be habitable and empty, as an unoccupied flat has a roof and water but nobody in it. The Moon has almost no air, so water would boil or freeze, and its gravity is only about one-sixth of Earth’s, too weak to keep air. Accept also: no greenhouse blanket, so it swings between very hot and very cold. Venus. It matches Earth in size and roughly in mass, but its thick carbon dioxide air traps heat, making it hot and crushing. “Twin” is only true for size and weight. A dip of 1 per cent means (planet width divided by star width) squared is 0.01, so the ratio is 0.1: the planet is about a tenth as wide as the star. Repeats at the same gap show the planet is going round the star in 12 days, and rule out a one-time event such as a passing object. A planet shines only by reflected l...

Parse and separate strings in records of a flat file

Lets say we have a file with records containing some strings which we care about. Lets assume all these strings of interest follow a pattern in the records such that they are followed by the word 'COPY' and then a space after it. The file would look something like: 12345COPY string1  111COPY string2 1234COPY string3 Now we want the output file to have all these "string*" values as the records of length 8 characters. For this we can use the Parse command of DFSORT in the following way. //SP02 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=DAIW.IMG.SRTPARSE.IN,DISP=SHR //SORTOUT DD DSN=DAIW.IMG.SRTPARSE.OUT, //             RECFM=FB, //             LRECL=8, //             DSORG=PS, //             AVGREC=U, //             SPACE=(TRK,(20,10),RLSE), //             DISP=(NEW,CATLG,DELETE),...

Using JOINKEYS of DFSORT for matching and merging datasets

Joinkeys applications of DFSORT is a very useful application to match and merge files. The below example joins two input datasets based on a key. The two datasets may have the keys in different data formats, so we can use various data conversion techniques of SORT using INREC in the JNF*CNTL files. Matched records, Records which are only present in dataset 1 and records which are present only in dataset 2 can be segregated using this technique. 
//JS010 EXEC PGM=SORT
 //SYSOUT DD SYSOUT=*
 //IN1 DD DSN=ATOM.INPUT.DATASET1,DISP=SHR 
//IN2 DD DSN=ATOM.INPUT.DATASET2,DISP=SHR 
//SYMNAMES DD *    IN1_CUST_ZD,3,6,ZD
       IN2_CUST_PD,6,4,PD
       IN2_CUST_ZD,=,6,ZD
 //JNF1CNTL DD *    INREC OVERLAY=(IN1_CUST_ZD:IN1_CUST_ZD,TO=ZDF,LENGTH=6) 
//JNF2CNTL DD *    INREC OVERLAY=(IN2_CUST_PD:IN2_CUST_PD,TO=ZDF,LENGTH=6) 
//OUT1   DD SYSOUT=*
 //OUT2   DD SYSOUT=*
 //OUT12  DD DSN=ATOM.OUTPUT.DATA...