Sorting Detail records
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Sorting Detail records Author: ramg_marLocation: india PostPosted: Tue Feb 17, 2004 11:16 pm
    —
Hi all,
I have a input file with the following format

HEADER 02/05/2004
522222222 ----------------------------->
517001053 ----------------------------->
517001194 ----------------------------->
517001202 -----------------------------> Detail Records
517001210 -----------------------------> Detail Records
517001228

TRAILER 000000018

Can we have a 'single' sort step to sort only the detail records based on the account no (9 bytes)?. The output file should retain the header and trailer in its previous position.

Thanks,
Ramesh Question

#2:  Author: kolusuLocation: San Jose PostPosted: Wed Feb 18, 2004 6:58 am
    —
Ramg_mar,

The following DFSORT/ICETOOL JCL will give you the desired results. If you have syncsort at your shop then change the pgm name to synctool. A brief explanation of the job.

I assumed that your input file is 80 bytes in length and is of FB recfm.

The first copy operator splits the input records into 2 files. The header and trailer will be copied to t1 and the detailed records to t2. we also a add a constant value of 0 and max of 99999999 for header and trailer respectively , so that we can put the header and trailer as the first and last records of the file once again.

The detailed records copied to t2 are sorted on the first 9 bytes and are written to T3 with a seqnum.

Now concatenate both T1 and T3 and sort on the seqnum and remove the seqnum while writting it out.

I haven't tested it but it should give you the desired results , unless i half awake in the morning.

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG   DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//IN        DD *                                           
HEADER 02/05/2004                                         
522222222 ----------------------------->                   
517001053 ----------------------------->                   
517001194 ----------------------------->                   
517001202 -----------------------------> DETAIL RECORDS   
517001210 -----------------------------> DETAIL RECORDS   
517001228                                                 
TRAILER 000000018                                         
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON      DD DSN=&T1,DISP=OLD,VOL=REF=*.T1             
//         DD DSN=&T3,DISP=OLD,VOL=REF=*.T3 
//OUT      DD DSN=YOUR OUTPUT SORTED FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//TOOLIN   DD *                                           
  COPY FROM(IN)  USING(CTL1)                               
  SORT FROM(T2)  USING(CTL2)                               
  SORT FROM(CON) USING(CTL3)                               
//CTL1CNTL  DD *                                           
  OUTFIL FNAMES=T1,INCLUDE=(1,7,CH,EQ,C'HEADER ',OR,       
                            1,7,CH,EQ,C'TRAILER'),         
  OUTREC=(1,80,81:1,7,CHANGE=(8,C'HEADER ',C'00000000',     
                                C'TRAILER',C'99999999'),   
                                NOMATCH=(C'99999999'))     
  OUTFIL FNAMES=T2,SAVE                                     
//CTL2CNTL  DD *                                   
  SORT FIELDS=(1,9,ZD,A)                           
  OUTFIL FNAMES=T3,OUTREC=(1,80,SEQNUM,8,ZD)       
//CTL3CNTL  DD *                                   
  SORT FIELDS=(81,8,ZD,A)                           
  OUTFIL FNAMES=OUT,OUTREC=(1,80)                   
/*                                                 


Hope this helps...

Cheers

Kolusu

#3:  Author: ramg_marLocation: india PostPosted: Wed Feb 18, 2004 7:36 am
    —
Exclamation Hi Kolusu,

Thanks for your valuable suggestions..

I've tried to test this, but the output file doesn't have the Header and trailer in its previous position.

here is the output file,

TRAILER 000000018
HEADER 02/05/2004
517001053
517001194
517001202
517001210
517001228
517001236
517001244

Is any changes needs to be done?

Thanks,
Ramesh

#4:  Author: kolusuLocation: San Jose PostPosted: Wed Feb 18, 2004 8:31 am
    —
Ramg_mgr,


Did you run the job exactly as I have shown? I just ran the same JCL as is and this is what I get.
Code:

HEADER 02/05/2004                                         
517001053 ----------------------------->                   
517001194 ----------------------------->                   
517001202 -----------------------------> DETAIL RECORDS   
517001210 -----------------------------> DETAIL RECORDS   
517001228                                                 
522222222 ----------------------------->                   
TRAILER 000000018                                         


What is your input file LRECL and recfm? As I mentioned before I assumed that it is 80 bytes and is of FB recfm.

Please post your JCL and and let me take a look at it.

Thanks

Kolusu

#5:  Author: ramg_marLocation: india PostPosted: Wed Feb 18, 2004 8:39 am
    —
Hi Kolusu,

I am using the input file with record lenght 80 and the recfm is FB only. But, I am not able to get the Header and trailer in correct position.

This is the jcl I am using,

Code:
//STEP0100 EXEC PGM=SYNCTOOL                                     
//TOOLMSG   DD SYSOUT=*                                           
//DFSMSG    DD SYSOUT=*                                           
//IN        DD DSN=TSORGOV.STMP05D1.TEST.SORT,DISP=SHR           
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)       
//T2        DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)       
//T3        DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)       
//CON       DD DSN=&T1,DISP=OLD,VOL=REF=*.T1                     
//          DD DSN=&T3,DISP=OLD,VOL=REF=*.T3                     
//OUT       DD DSN=TSORGOV.TEST.ICETOOL.OUTPUT,                   
//            DISP=(NEW,CATLG,DELETE),                           
//            UNIT=SYSDA,                                         
//            SPACE=(CYL,(10,10),RLSE)                           
//TOOLIN    DD *                                                 
  COPY FROM(IN)  USING(CTL1)                                     
  SORT FROM(T2)  USING(CTL2)                                     
  SORT FROM(CON) USING(CTL3)                                     
//CTL1CNTL  DD *                                                 
  OUTFIL FNAMES=T1,INCLUDE=(1,7,CH,EQ,C'HEADER ',OR,             
                            1,7,CH,EQ,C'TRAILER'),               
  OUTREC=(1,80,81:1,7,CHANGE=(8,C'HEADER ',C'00000000',           
                                C'TRAILER',C'99999999'),         
                                NOMATCH=(C'99999999'))       
  OUTFIL FNAMES=T2,SAVE                                       
//CTL2CNTL  DD *                                             
  SORT FIELDS=(1,9,ZD,A)                                     
  OUTFIL FNAMES=T3,OUTREC=(1,80,SEQNUM,8,ZD)                 
//CTL3CNTL  DD *                                             
  SORT FIELDS=(81,8,ZD,A)                                     
  OUTFIL FNAMES=OUT,OUTREC=(1,80)                             
/*                                                           

THanks,
Ramesh

#6:  Author: kolusuLocation: San Jose PostPosted: Wed Feb 18, 2004 8:49 am
    —
Ramg_mgr,


Another way of doing it using disp=mod for the output dataset.The following DFSORT/ICETOOL jcl will give you the desired results. A brief explanation of the job.

The first copy operator copies the header record to the output file.

The second sort operator sorts the detail records omitting the header and trailer records. It appeneds the sorted records to header record in the output file

The third copy operator copies the trailer record and appends it to the output file

Code:

//STEP0200 EXEC PGM=ICETOOL                                   
//TOOLMSG   DD SYSOUT=*                                       
//DFSMSG    DD SYSOUT=*                                       
//IN        DD *                                             
HEADER 02/05/2004                                             
522222222 ----------------------------->                     
517001053 ----------------------------->                     
517001194 ----------------------------->                     
517001202 -----------------------------> DETAIL RECORDS       
517001210 -----------------------------> DETAIL RECORDS       
517001228                                                     
TRAILER 000000018                                             
//OUT      DD DSN=YOUR OUTPUT FILE,                       
//            DISP=(MOD,CATLG,DELETE),                       
//            UNIT=SYSDA,                                     
//            SPACE=(CYL,(X,Y),RLSE)                         
//TOOLIN   DD *                                               
  COPY FROM(IN) USING(CTL1)                                   
  SORT FROM(IN) USING(CTL2)                                   
  COPY FROM(IN) USING(CTL3)                                   
//CTL1CNTL DD *                                               
  OPTION STOPAFT=1                                           
  OUTFIL FNAMES=OUT                                           
//CTL2CNTL DD *                                               
  OMIT COND=(1,7,CH,EQ,C'HEADER ',OR,1,7,CH,EQ,C'TRAILER')   
  SORT FIELDS=(1,9,ZD,A)                                     
  OUTFIL FNAMES=OUT                                           
//CTL3CNTL DD *                                               
  INCLUDE COND=(1,7,CH,EQ,C'TRAILER')                         
  OUTFIL FNAMES=OUT                                           
/*



Hope this helps...

Cheers

Kolusu

#7:  Author: kolusuLocation: San Jose PostPosted: Wed Feb 18, 2004 8:50 am
    —
Ramesh,

There is nothing wrong with the JCL you posted. Can you post the sysout of TOOLMSG and also the DFSMSG?

Kolusu

#8:  Author: ramg_marLocation: india PostPosted: Wed Feb 18, 2004 7:54 pm
    —
Hi Kolusu,

I got the desired results with the second solution.. (using disp=mod for the output dataset). Thanks for your solution within a short period!


Thanks,
Ramesh

#9:  Author: kolusuLocation: San Jose PostPosted: Thu Feb 19, 2004 6:17 am
    —
ramg_mgr,

Even though the second solution worked for you I am curious to know as to why the first solution is giving you wrong results. I am 100% confident that my 1st posted solution will work. If you say it is not then I would like to look at the TOOLMSG and DFSMSG of the Job. As such there is nothing special in that job that will give you the wrong results.

Kolusu

#10:  Author: SureshKumar PostPosted: Thu Feb 19, 2004 8:36 am
    —
Ramq_mar,
just to add my 2 cents, I ran the first soultion without any changes and it worked fine for me. Thanks

#11:  Author: PhantomLocation: The Blue Planet PostPosted: Wed Apr 21, 2004 4:53 am
    —
Hi All,

I tried to solve the same problem using PGM=SORT in one step (one pass). I don't know whether this solution is efficient. Please give me your valuable suggestions.

Code:

//R012     EXEC PGM=SORT                                               
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD  *
HEADER 02/05/2004                                         
522222222 ----------------------------->                   
517001053 ----------------------------->                   
517001194 ----------------------------->                   
517001202 -----------------------------> DETAIL RECORDS   
517001210 -----------------------------> DETAIL RECORDS   
517001228                                                 
TRAILER 000000018                                         
/*
//SORTOUT  DD  DSN=MY OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),                                 
//             UNIT=SYSDA,                                             
//             AVGREC=K,                                               
//             SPACE=(80,(10,2),RLSE),                                 
//             DCB=(RECFM=FB,LRECL=80)                                 
//SYSIN    DD  *                                                       
 INREC FIELDS=(1,7,CHANGE=(8,C'HEADER ',C'HEADER 1',                   
                            C'TRAILER',C'TRAILER '),                   
                   NOMATCH=(1,7),8,73)                                 
 SORT FIELDS=(8,1,CH,D,1,9,CH,A)                                       
 OUTFIL OUTREC=(1,7,9,73)                                             
/*     


PLEASE NOTE ****: In the code the blank space following TRAILER (in change command) is not a blank. It is a LOW-VALUE character X'00'. When U cut & paste the code on ur mainframe make sure you change the space in C'TRAILER ' to low-value (using HEX ON).

What I have done here is I have modified 'HEADER ' as 'HEADER 1' and 'TRAILER' as 'TRAILER' + X'00' (Low-value) using Change command. The data portion of the file will have a Blank space in the 8th character due to NOMATCH command. (I have temporarily increased the size of file from 80 to 81 by introducing a new char at pos 8 ).

Now when I sort on column 8 in descending order, the Char '1' in HEADER will come in the first line followed by Blanks in data portion. The trailer will end up as the last record because of the low-value in column 8. Now since the data records are grouped together, the second level sorting 1,9,CH,A will arrange them in required order.

Finally using OUTREC I remove the character inserted as pos 8.

Please give me your suggestions,

#12:  Author: kolusuLocation: San Jose PostPosted: Wed Apr 21, 2004 8:41 am
    —
Phantom,

That is a clever trick. I modified it slightly so that it will be easy to code the control cards. I mean it would be more effort to change to binary zeroes using hex on.

So you can change the header to '3' and the detail records to '2'(no match) and trailer to '1', so that you will not get into editing using hex on.

i.e

Code:

 INREC FIELDS=(1,7,1,7,CHANGE=(1,C'HEADER ',C'3',     
                                 C'TRAILER',C'1'),
                        NOMATCH=(C'2'),8,73)
 SORT FIELDS=(8,1,CH,D,1,9,CH,A)                       
 OUTFIL OUTREC=(1,7,9,73)                             


However I do not like to introduce an addition character in the middle. I prefer adding it at the end.

so the control cards will be as follows:

Code:

 INREC FIELDS=(1,80,1,7,CHANGE=(1,C'HEADER ',C'3',             
                                  C'TRAILER',C'1'),             
                    NOMATCH=(C'2'))                             
 SORT FIELDS=(81,1,CH,D,1,9,CH,A)                               
 OUTFIL OUTREC=(1,80)                                           


Kolusu

#13:  Author: PhantomLocation: The Blue Planet PostPosted: Wed Apr 21, 2004 8:54 am
    —
Thats really nice Kolusu,

I was breaking my head so much to avoid using the Hexa chars. Nothing came to my mind....

Thanks a lot for the help kolusu....

#14:  Author: nguyenh PostPosted: Tue Nov 09, 2004 11:28 am
    —
Hi Kolusu,
How do I modify this skeleton so that it sorts the detail records in a file that contains multiple headings and detail records like this:
Let say I want to sort by filename (a 6 characters extracted from columns 39-44 of the heading records) and column 77-78, those contains AA, CC....
Input file is 80 characters long, record format FB, record length is 80
Code:

********************************MEMBERBFS     **********************************
********************************MEMBERFILEHDR **********************************
  PEMP      033      090195K.B. THOMAS     7134831380       NSTS21286SM2    AA
EMP.1R............003392.EMP.1R.....                                        AB
********************************MEMBERFILE01  **********************************
  PEMP      033      090195K.B. THOMAS     7134831380       NSTS21286SM2    AA
                                                                           1CA
                     PF01  102S    OUT        1501                          CB01
P03K6097J 04EVENT   DEPL HEATERS PWR ON (K2)          O                     CC
********************************MEMBERFILE02  **********************************
                                                                           2CA
P03K6035L 05EVENT   SFMDM EEPROM WRITE ENABLE CORES                         CC
P03K6035L L  O            ON      02  PF01SIO101501      SS X  S     L    32CD
P03K6035L P03K6035E           P33M9001J                                     CE
********************************MEMBERFILE03  **********************************
                                                                           3CA
********************************MEMBERFILE04  **********************************
 907 53   L  O                       1.00BIPL08051201600200  20032820.184615TA
 907 53FFAFC40  F0001       U0000004         1  2  16                       TB
 906 53   L  O                       1.00BIPL08009800400100  10003125.000000TA
********************************MEMBERFILE05  **********************************
  EMP       033      020491MICHAEL PLATOFF 7134838487       NSTS18411SM2    AA
                                                                           1CA
********************************MEMBERFILE06  **********************************
                                                                           2CA
P33K9901L 24EVENT   HTRS ON/OFF                        HTRS ON/OFF          CC
P33K9901L    O            ON      01                     QQ X H      L      CD
P33K9901L 10003D00018098D5550000020002F1D5550000020001F2D55510000           CL01
P33K9901L               0000022000D3D5550000021000E3D5550000                CL02
P33K9901L               02008073D5550000020040B3                            CL03
P33K9902L 56EVENT   PCB K-RELAYS                       PCB K-RELAYS         CC


The output file will be 86 characters long. a 6 characters file name extracted from columns 39-44 of the heading records. will be abended at the end of each of the records to indicate where the record belong to like this:
Code:

********************************MEMBERFILEHDR **********************************BFS
  EMP       033      020491MICHAEL PLATOFF 7134838487       NSTS18411SM2    AA  FILEHD
  OARE      014      061390RICHARD O. DRAKE7134833043                SM2    AA  FILEHD
  PCSDLST   092      040595M. WILLIS       7134831040       NSTS18411SM2    AA  FILEHD
  PEMP      033      090195K.B. THOMAS     7134831380       NSTS21286SM2    AA  FILEHD
  PTSS      013      090595K.B. THOMAS     7134831380       NSTS21286SM2    AA  FILEHD
  TSS       013      020491MICHAEL PLATOFF 7134838487       NSTS18411SM2    AA  FILEHD
  UMP.UMP3  004      080295SONJA SUMMERS   7134834217       NSTS21249SM2    AA  FILEHD
EMP.1R............003392.EMP.1R.....                                        AB  FILEHD
EMP.1R.HZD.CMDS...003133.EMP.1R.....                                        AB  FILEHD
OARE..............001719............                                        AB  FILEHD
TSS.1R............003392.TSS.1R.....                                        AB  FILEHD
TSS.1R.HZD.CMDS...003133.TSS.1R.....                                        AB  FILEHD
TSS.1R.PCS.SUPPORT003133.TSS.1R.....                                        AB  FILEHD
USMP.3............003407.USMP.3.....                                        AB  FILEHD
                                                                           1CA  FILE01
                     PF01  102S    OUT        1501                          CB01FILE01
  PEMP      033      090195K.B. THOMAS     7134831380       NSTS21286SM2    AA  FILE01
P03K6097J 04EVENT   DEPL HEATERS PWR ON (K2)          O                     CC  FILE01
                                                                           2CA  FILE02
P03K6035L 05EVENT   SFMDM EEPROM WRITE ENABLE CORES                         CC  FILE02
P03K6035L L  O            ON      02  PF01SIO101501      SS X  S     L    32CD  FILE02
                                                                           3CA  FILE03
P03C2201A 10AMP     EMP EXPERIMENT DC CURRENT                               TI  FILE04
P03C2201A J   BSS     L  O        0  500                                    TJ  FILE04


Thank you for your helps!
nguyenhh

#15:  Author: nguyenh PostPosted: Tue Nov 09, 2004 11:29 am
    —
sorry, this line:
Code:
********************************MEMBERFILEHDR **********************************BFS

should be changed to:
Code:
********************************MEMBERFILEHDR **********************************FILEHDR

#16:  Author: kolusuLocation: San Jose PostPosted: Tue Nov 09, 2004 11:55 am
    —
nguyenh,

Let me put your requirement in simple terms.

Code:

col 1- 38       col 39-44       col 77 - 78
****************header rec1*****************
detail rec 3     key400            cc
detail rec 2     key100            aa
....
****************header rec2*****************
detail rec 1     key300            cc
detail rec 5     key200            aa
....



Now

1. you just want 1 header record
2. sort all the detail records on col 39 -44 and col 77- 78
3. you want to append the columns 39 thru at the end of each record

sample output

Code:

****************one header*****************
detail rec 2     key100            aa           key100
detail rec 5     key200            aa           key200
detail rec 1     key300            cc           key300
detail rec 3     key400            cc           key400


Is this what you wanted ?

Kolusu

#17:  Author: nguyenh PostPosted: Tue Nov 09, 2004 2:05 pm
    —
Kolusu,
Here is exactly what it should be:

Code:

col 1- 38                          39-44       77 - 78
****************header key001********
detail rec 3                                        cc
detail rec 2                                        aa
....
****************header key002********
detail rec 1                                        cc
detail rec 5                                        aa
....



Quote:

1. you just want 1 header record (Yes! the first one only)
2. sort all the detail records on col 39 -44 and col 77- 78 (Yes!)
3. you want to append the columns 39 thru 44 at the end of each record (Yes!)



Here is sample output:

Code:

col 1- 38                          39-44     77-78  81-82
****************header key001*****************
detail rec 2                                        aa  key001
detail rec 3                                        cc   key001
....
detail rec 5                                        aa  key002
detail rec 1                                        cc   key002
...


Thank you very much for your helps!
nguyenhh

#18:  Author: nguyenh PostPosted: Tue Nov 09, 2004 2:10 pm
    —
Oop! I messed them up.

Code:

col 1- 38       39-44       77-78
****************key001*************
detail rec 3                   cc
detail rec 2                   aa
....
****************key002*************
detail rec 1                   cc
detail rec 5                   aa
...


Code:

col 1- 38        39-44     77-78 81-82
****************key001*****************
detail rec 2               aa    key001
detail rec 3               cc    key001
....
detail rec 5               aa    key002
detail rec 1               cc    key002

#19:  Author: nguyenh PostPosted: Tue Nov 09, 2004 2:12 pm
    —
Sorry,
it's 81- 86 , not 81-82

#20:  Author: kolusuLocation: San Jose PostPosted: Tue Nov 09, 2004 3:29 pm
    —
nguyenh,

The following DFSORT/ICETOOL JCL will give you the desired results. If you have syncsort at your shop then change the pgm name to synctool. However you need the latest version of syncsort to run this jcl which supports the splice parameter.

A brief explanation of the job. I assumed that your header record is identified by * in the 1st byte. I also assumed that your detail record is key the first 12 bytes.

The first copy operator splits the file into 2 files, namely HDR and detail. we first a seqnum of 8 bytes of ZD format to records using INREC fields.

Using OUTFIL we split the records into 2 HDR and DET files. On the header record we zero out the seqnum and start new seqnum of 8 bytes of ZD format from 89th byte. We also add an indicator 'H' and copy the contents from 39 thru 44.

All the detail records are copied into DET file. we add an indicator of "z" to all the detail records.

The next SORT operator concatenates the above created HDR & DET files and using INREC we perform the tagging the record no: to all the detail records.

We now sort on the tagno and the indicator and the detail records key( 1 thru 12)

By doing so the detail records are sorted within each header.

We take the output from the sort step and use splice operator to splice the header name at the end of every detail record.

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//DFSMSG   DD SYSOUT=*                                       
//TOOLMSG  DD SYSOUT=*                                       
//IN       DD DSN=YOUR INPUT FILE,
//            DISP=SHR                                       
//HDR      DD DSN=&HDR,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)   
//DET      DD DSN=&DET,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)   
//CON      DD DSN=*.HDR,VOL=REF=*.HDR,DISP=OLD               
//         DD DSN=*.DET,VOL=REF=*.DET,DISP=OLD               
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)   
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
   COPY FROM(IN)  USING(CTL1)                                 
   SORT FROM(CON) USING(CTL2)                                 
   SPLICE FROM(T3) TO(OUT) -                                 
           ON(87,8,CH) -                                     
           WITH(1,80) -                                       
           WITHALL  USING(CTL3)                               
//CTL1CNTL DD *                                               
   INREC  FIELDS=(1,80,SEQNUM,8,ZD)                           
   OUTFIL FNAMES=HDR,INCLUDE=(1,1,CH,EQ,C'*'),               
   OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H',39,6)                 
   OUTFIL FNAMES=DET,SAVE,                                   
   OUTREC=(1,88,SEQNUM,8,ZD,C'Z',6X)                         
//CTL2CNTL DD *                                               
  OPTION EQUALS                                               
  INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)
  SORT   FIELDS=(97,8,ZD,A,105,1,CH,A,1,12,CH,A)             
  OUTFIL FNAMES=T3,OUTREC=(1,80,106,6,97,8)                   
//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT,OUTREC=(1,86)                 
/*


Hope this helps...

Cheers

kolusu

#21:  Author: nguyenh PostPosted: Wed Nov 10, 2004 11:42 am
    —
Kolusu,
Thank you so much for your helps. The code works perfect for current requirements, however there are more functionalities that I want it to do. but
at the moment I am still trying to understand what the code is doing.
I will come back with more questions. I hope you dont mind. I really appreciate for your helps!

Big Thanks!
nguyenh

#22: help me understand this code Author: nguyenh PostPosted: Thu Nov 11, 2004 1:51 pm
    —
Kolusu,
Could you please help me understand what each of these parameters in this code does, and what the output records will look like after execute it ?

Code:
             
   OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H',39,6)                 
   OUTFIL FNAMES=DET,SAVE,                                   
   OUTREC=(1,88,SEQNUM,8,ZD,C'Z',6X)                         


Thank you!
nguyenh

#23:  Author: kolusuLocation: San Jose PostPosted: Thu Nov 11, 2004 2:12 pm
    —
nguyenh,


Code:

OUTREC=(1,80,          $ Copy 80 bytes from pos1 of input
        8C'0',         $ pad 8 zeroes 
        SEQNUM,8,ZD,   $ seqnum( record #)
        C'H',          $ char of 'h'
        39,6)          $ Copy 6 bytes from pos 39 of input       

   OUTFIL FNAMES=DET,SAVE,                                     
   OUTREC=(1,88,          $ Copy 88 bytes from pos 1 of inrec
           SEQNUM,8,ZD,   $ seqnum( record #)
           C'Z',          $ char of 'z'
           6X)            $ pad 6 spaces.


option SAVE operates in a global fashion over all of the other OUTFIL statements for which SAVE is not specified, enabling you to keep any OUTFIL input records that would not be kept otherwise. SAVE will include the same records for each group for which it is specified.

In simple terms it is acts like the ELSE part of IF condition.

Code:

 IF COND = 'A' OR 'B' OR 'C'
    PUT OUTPUT1
 ELSE
   PUT OUTPUT2
 END-IF


Hope this helps...

Cheers

kolusu

#24:  Author: nguyenh PostPosted: Wed Nov 17, 2004 5:20 pm
    —
Thanks Kolusu,
Here is my next question, by looking at the code below:
is it possible to do something like this, if so could you please show me how.

Code:

//CTL2CNTL DD *
  OPTION EQUALS
  INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)
  SORT   FIELDS=(97,8,ZD,A,1,9,CH,A,105,1,CH,A,1,12,CH,A)
  OUTFIL FNAMES=T3,OUTREC=(1,80,106,6,97,8)
//CTL3CNTL DD *
  OUTFIL FNAMES=OPFILE,OUTREC=(1,86)
/*

If INREC FIELDS 1-1 is not blank and/or ....
   SORT   FIELDS=(97,8,ZD,A,1,9,CH,A,105,1,CH,A,1,12,CH,A)
ElseIf INREC FIELDS 1-1 is blank  and/or INREC FIELDS 77-78 is "CA"  and/or .....
   SORT   FIELDS=(97,8,ZD,A,105,1,CH,A,1,12,CH,A)
Else  SORT  FIELDS=(97,8,ZD,A,105,1,CH,A,1,12,CH,A............)


If this is not the way we do thing, then or is there another way?

Thank you very much for your helps!
nguyenh

#25:  Author: nguyenh PostPosted: Tue Dec 07, 2004 3:57 pm
    —
Code:

//CTL2CNTL DD *                                               
  OPTION EQUALS                                               
  INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)
  SORT   FIELDS=(97,8,ZD,A,105,1,CH,A,1,12,CH,A)             
  OUTFIL FNAMES=T3,OUTREC=(1,80,106,6,97,8)                   
//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT,OUTREC=(1,86)                 
/*

Sorry it's me again. Could someone please help me understand the above lines:
or please show me a link to the document that helps me understand this.

Thank you!

#26:  Author: kolusuLocation: San Jose PostPosted: Tue Dec 07, 2004 4:21 pm
    —
nguyenh,

OPTION EQUALS| NOEQUALS : Determines whether or not the sort will preserve the order of records with identical sort fields. NOEQUALS is the default, and causes equal-keyed records to be written in a random order,not in the order they were encountered.

Code:

  INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)


1,96 means copy the contents from byte 1 for a length of 96

(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8 means subtract the contents at 81 for 8 bytes from contents at 89 for 8 bytes and write out the result in the format TTTTTTTT ( no zero suppression as 9(08 ) in cobol)

97,7 means means copy the contents from byte 97 for a length of 7

Code:

Sort fields=(97,8,ZD,A,   $ sort on 8 bytes starting at 97
            105,1,CH,A,   $ sort on 1 byte starting at 105
            1,12,CH,A)    $ sort on 12 bytes starting at 1



Code:

  OUTFIL FNAMES=T3,      $ output file DD name
  OUTREC=(1,80,          $ copy 80 bytes from pos 1
          106,6,         $ copy 6 bytes from pos 106
          97,8)          $ copy 8 bytes from pos 97                   


Code:

//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT,     $ output file DD name
  OUTREC=(1,86)          $ copy 86 bytes from pos 1                 


If your shop has DFSORT then you can access the DFSORT manual from here.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/CONTENTS?SHELF=&DT=20031124143823#CONTENTS


Hope this helps...

cheers

kolusu

#27:  Author: Frank YaegerLocation: San Jose PostPosted: Tue Dec 07, 2004 4:29 pm
    —
This a portion of a DFSORT/ICETOOL job Kolusu showed earlier. The CTL2CNTL DD supplies DFSORT statements for the SORT operator with USING(CTL2) and the CTL3CNTL DD supplies DFSORT statements for the SPLICE operator with USING(CTL3).

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "DFSORT: Getting Started". It's an excellent tutorial that will teach you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online at:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG00/CCONTENTS

For complete information on DFSORT's ICETOOL, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/6.0?DT=20031124143823

For complete information on the SPLICE operator of DFSORT's ICETOOL, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/6.13?SHELF=&DT=20031124143823&CASE=

Here's a brief explanation of the DFSORT control statements in CTL2CNTL and CTL3CNTL.

CTL2CNTL statements:

EQUALS tells DFSORT to keep the original order of duplicate records.

INREC reformats the records before they are sorted using the following fields: 1-96; the ZD value in positions 81-88 minus the ZD value in positions 89-96, and 97-103. M11,LENGTH=8 edits the result of the subtraction.

SORT sorts the records ascending on the following fields in the reformatted INREC record: the ZD field in positions 97-104, the CH field in position 105 and the CH field in positions 1-12.

OUTFIL writes records to the T3 DD data set after they are sorted. OUTREC reformats the records for output using the following fields: positions 1-80, positions 106-111 and positions 97-104.

CTL3CNTL statements:

OUTFIL writes records to the OUT DD data set after they are spliced. OUTREC reformats the records using positions 1-86.

#28:  Author: nguyenh PostPosted: Tue Dec 07, 2004 5:05 pm
    —
Frank Yaeger,
Thank you very much. I actually read your mini ICETOOLS Userguide D/N: Fc27-1997-00 that is very impressive work of you, I even have a copy of it on my desk. But since I am a mainframe and DFSORT beginner so I need something more for dummy Smile. I will read DFSORT links that you suggested.

Kolusu,
Thank you for your helps. Now I understand that part,

This is the part that I am still confused on, I tried to catalog all the temporary datasets, so that I can see the actual data being put in them, but couldn't get it to work (I am very bad in mainframe), so I have to ask you this one more time:

Based on your explaination of the following code:

Code:

OUTREC=(1,80,          $ Copy 80 bytes from pos1 of input
        8C'0',         $ pad 8 zeroes 
        SEQNUM,8,ZD,   $ seqnum( record #)
        C'H',          $ char of 'h'
        39,6)          $ Copy 6 bytes from pos 39 of input 
       


so after the above lines has been executed: am I correct that the output records will have the following format?

Code:

[80 bytes from byte 1][8 zeros][8 bytes sequence number][H][6 bytes from byte 39]


so total record length = 80+8+8+1+6 = 103 ????


Thank you all again!

#29:  Author: kolusuLocation: San Jose PostPosted: Tue Dec 07, 2004 5:25 pm
    —
Quote:

so total record length = 80+8+8+1+6 = 103 ????


nguyenh,

You understanding of the control cards is correct !!

Kolusu

#30:  Author: PhantomLocation: The Blue Planet PostPosted: Tue Dec 07, 2004 11:20 pm
    —
nguyenh,

Code:

I tried to catalog all the temporary datasets, so that I can see the actual data being put in them, but couldn't get it to work (I am very bad in mainframe), so I have to ask you this one more time:


You can do that easily. All you need to do is to create & catalog the datasets before the sort step. use IEFBR14 to create an empty file (& catalog it). Then use the datasets in the SYNCTOOL/ICETOOL with DISP as SHR.

Hope this helps,

Thanks,
Phantom

#31:  Author: kolusuLocation: San Jose PostPosted: Wed Dec 08, 2004 5:27 am
    —
Quote:

All you need to do is to create & catalog the datasets before the sort step. use IEFBR14 to create an empty file (& catalog it). Then use the datasets in the SYNCTOOL/ICETOOL with DISP as SHR.


Phantom,

You can directly catlg the datasets in the sort step itself instead of using an IEFBR14 step to catlg the datasets

i.e
Code:

//T1       DD DSN=USERID.TEMP.DSN1,DISP=(,CATLG),SPACE=(CYL,(X,Y),RLSE)
//T2       DD DSN=USERID.TEMP.DSN2,DISP=(,CATLG),SPACE=(CYL,(X,Y),RLSE)
//CON      DD DSN=*.T1,VOL=REF=*.T1,DISP=OLD             
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=OLD             


Hope this helps...

Cheers

Kolusu

#32:  Author: PhantomLocation: The Blue Planet PostPosted: Wed Dec 08, 2004 5:58 am
    —
Thanks a lot Kolusu,

I had problems using DISP=SHR but never realised that DISP=OLD will solve that.

Thanks,
Phantom

#33:  Author: nguyenh PostPosted: Mon Jan 10, 2005 12:06 pm
    —
Hi Kolusu and all,
Can you please help me correct this non-working CTL4CNTL.
Here is a segment of code that I am trying to do, I thought it would work, but it wouldn't Smile

Thank you very much!

Code:

//TOOLIN   DD *
   COUNT FROM(IPFILE)
   COPY FROM(IPFILE) USING(CTL1)
   COPY FROM(CON) USING(CTL2)
   SPLICE FROM(TEMP1) TO(TEMP2) -
           ON(87,8,CH) -
           WITH(1,80) -
           WITHALL USING(CTL3)
   COPY FROM(TEMP2) USING(CTL4)
//CTL1CNTL DD *
   INREC  FIELDS=(1,80,SEQNUM,8,ZD)
   OUTFIL FNAMES=HEADER,INCLUDE=(1,1,CH,EQ,C'*'),
   OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H',39,6)
   OUTFIL FNAMES=DETAIL,SAVE,
   OUTREC=(1,88,SEQNUM,8,ZD,C'Z',6X)
//CTL2CNTL DD *
   INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)
   OUTFIL FNAMES=TEMP1,OUTREC=(1,80,106,6,97,8,89,8)
//CTL3CNTL DD *
   OUTFIL FNAMES=TEMP2,OUTREC=(1,86,SEQNUM,7,ZD)
//CTL4CNTL DD *
   OUTFIL FNAMES=TEMP3,INCLUDE COND=(1,1,CH,EQ,C' ',OR,
                                     77,2,CH,EQ,C'TA',OR,
                                     77,2,CH,EQ,C'TB',OR,
                                     77,2,CH,EQ,C'TC',OR),OUTREC=(1,93,2,4,6X) $ PUT INTO TEMP3 THIS INCLUDE COND= DOES NOT WORK.                                     
   OUTFIL FNAMES=TEMP4,INCLUDE=(77,2,CH,EQ,C'TT'),OUTREC=(1,93,10X,11,4) $ PUT INTO TEMP4
   OUTFIL FNAMES=TEMP5,SAVE,OUTREC=(1,93,1,10) $ PUT EVERYTHING ELSE INTO TEMP5
/*

#34:  Author: kolusuLocation: San Jose PostPosted: Mon Jan 10, 2005 12:28 pm
    —
nguyenh,

You have an extra OR in the include cond after 'TC' for Temp3. Also you should just have INCLUDE on OUTFIL , instead of INCLUDE COND. Change your CTL4CNTL to the following.
Code:

//CTL4CNTL DD *
   OUTFIL FNAMES=TEMP3,
   INCLUDE=(1,1,CH,EQ,C' ',OR,
            77,2,CH,EQ,C'TA',OR,
            77,2,CH,EQ,C'TB',OR,
            77,2,CH,EQ,C'TC'),
   OUTREC=(1,93,2,4,6X)         
   OUTFIL FNAMES=TEMP4,INCLUDE=(77,2,CH,EQ,C'TT'),
   OUTREC=(1,93,10X,11,4)   
   OUTFIL FNAMES=TEMP5,SAVE,
   OUTREC=(1,93,1,10)
/*


Hope this helps...

Cheers

kolusu

#35:  Author: nguyenh PostPosted: Mon Jan 10, 2005 2:00 pm
    —
Kolusu,
Code:

You have an extra OR in the include cond after 'TC' for Temp3.

Oh, That was just a typo when message is being posted.

Code:
Also you should just have INCLUDE on OUTFIL , instead of INCLUDE COND. Change your CTL4CNTL to the following.


I thought I already tried this, but it didn't work, I may have done some thing wrong Smile let me try it and let you know.

Thanks alot Kolusu!

#36:  Author: kolusuLocation: San Jose PostPosted: Mon Jan 10, 2005 2:09 pm
    —
nguyenh,

Did you try with suggested code in my previous post? if you did try then please post your TOOLMSG & DFSMSG messages.

Thanks

kolusu

#37:  Author: nguyenh PostPosted: Mon Jan 10, 2005 2:42 pm
    —
kOLUSU,

I just already tried your suggested solution. It worked better than I expected. Smile
wonderful!

Thank you so very much.

#38:  Author: nguyenh PostPosted: Mon Jan 10, 2005 3:15 pm
    —
Hello Kolusu,
Could you please tell me what are my errors here? It looks correct to me, but I keep getting these errors
Code:

STMT NO. MESSAGE

297 IEF645I INVALID REFERBACK IN THE DSNAME FIELD
298 IEF645I INVALID REFERBACK IN THE DSNAME FIELD
299 IEF645I INVALID REFERBACK IN THE DSNAME FIELD
300 IEF645I INVALID REFERBACK IN THE DSNAME FIELD
301 IEF645I INVALID REFERBACK IN THE DSNAME FIELD
302 IEF645I INVALID REFERBACK IN THE DSNAME FIELD



Here is my JCL:

Code:

283 //IPFILE   DD DSN=NSDC656.TEMP1,DISP=SHR
284 //OPFILE   DD DSN=NSDC656.OLDLIST,DISP=(OLD,KEEP)
285 //HEADER   DD DSN=NSDC656.HEADER,
//   DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
286 //DETAIL   DD DSN=NSDC656.DETAIL,
//   DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
287 //CON   DD DSN=*.HEADER,VOL=REF=*.HEADER,DISP=OLD
288 //   DD DSN=*.DETAIL,VOL=REF=*.DETAIL,DISP=OLD
289 //TEMP1   DD DSN=NSDC656.A1,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
290 //TEMP2   DD DSN=NSDC656.A2,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
291 //TEMP3   DD DSN=NSDC656.A3,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
292 //TEMP4   DD DSN=NSDC656.A4,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
293 //TEMP5   DD DSN=NSDC656.A5,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
294 //TEMP6   DD DSN=NSDC656.A6,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
295 //TEMP7   DD DSN=NSDC656.A7,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
296 //TEMP8   DD DSN=NSDC656.A8,DISP=(NEW,CATLG),SPACE=(CYL,(20,10),RLSE)
297 //TEMP9   DD DSN=*.A3,VOL=REF=*.A3,DISP=OLD
298 //   DD DSN=*.A4,VOL=REF=*.A4,DISP=OLD
299 //   DD DSN=*.A5,VOL=REF=*.A5,DISP=OLD
300 //   DD DSN=*.A6,VOL=REF=*.A6,DISP=OLD
301 //   DD DSN=*.A7,VOL=REF=*.A7,DISP=OLD
302 //   DD DSN=*.A8,VOL=REF=*.A8,DISP=OLD
303 //TOOLIN   DD *




Thank you!

#39:  Author: kolusuLocation: San Jose PostPosted: Mon Jan 10, 2005 3:48 pm
    —
Code:

//TEMP9   DD DSN=*.A3,VOL=REF=*.A3,DISP=OLD
//        DD DSN=*.A4,VOL=REF=*.A4,DISP=OLD
//        DD DSN=*.A5,VOL=REF=*.A5,DISP=OLD
//        DD DSN=*.A6,VOL=REF=*.A6,DISP=OLD
//        DD DSN=*.A7,VOL=REF=*.A7,DISP=OLD
//        DD DSN=*.A8,VOL=REF=*.A8,DISP=OLD


You are referring to a ddname which is not present. If your intetion is to concatenate temp3 thru temp 8 then you need to code it as below

Code:

//TEMP9   DD DSN=*.TEMP3,VOL=REF=*.TEMP3,DISP=OLD
//        DD DSN=*.TEMP4,VOL=REF=*.TEMP4,DISP=OLD
//        DD DSN=*.TEMP5,VOL=REF=*.TEMP5,DISP=OLD
//        DD DSN=*.TEMP6,VOL=REF=*.TEMP6,DISP=OLD
//        DD DSN=*.TEMP7,VOL=REF=*.TEMP7,DISP=OLD
//        DD DSN=*.TEMP8,VOL=REF=*.TEMP8,DISP=OLD


Hope this helps...

Cheers

Kolusu

#40:  Author: nguyenh PostPosted: Mon Jan 10, 2005 4:04 pm
    —
Thanks Kolusu,

I see, I thought *.DataSetName means WhatEverHighLevelQualifier.ActualDataSetName.

I look at the example in the link below, they named both DSN = T1 therefore I am confused. Thank you again!

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1cg00/3.1.16?ACTION=MATCHES&REQUEST=Vol%3DRef%3D&TYPE=FUZZY&SHELF=&DT=20031124150117&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

#41:  Author: nguyenh PostPosted: Wed Jan 12, 2005 2:46 pm
    —
Hi kolusu,
I am trying to reference temporary datasets and getting this error. Why does that happen? is it not possible to reference temporary datasets the same way as we do with permanent datasets? Can you show me how to fix this error. Thanks!

:
Code:

//HEADER   DD DSN=&&&&HEADER,DISP=(NEW,PASS)
//DETAIL   DD DSN=&&&&DETAIL,DISP=(NEW,PASS)
//COMBIN   DD DSN=*.HEADER,VOL=REF=*.HEADER,DISP=OLD
//   DD DSN=*.DETAIL,VOL=REF=*.DETAIL,DISP=OLD


I got this error:
Code:

317 IEF648I INVALID DISP FIELD- PASS SUBSTITUTED
318 IEF648I INVALID DISP FIELD- PASS SUBSTITUTED


I tried this too, but get difference errors.
Code:

//HEADER   DD DSN=&&&&HEADER,DISP=(NEW,PASS)
//DETAIL   DD DSN=&&&&DETAIL,DISP=(NEW,PASS)
//COMBIN   DD DSN=HEADER
//   DD DSN=DETAIL

#42:  Author: kolusuLocation: San Jose PostPosted: Wed Jan 12, 2005 2:56 pm
    —
nguyenh,

You can create a temporary dataset using 2 ampersands followed by a character string 1 to 8 characters in length. You had 4 ampersands which is not a valid syntax

However, if you code a data set name as a symbolic parameter (by coding DSNAME=&xxxxxxxx), and do not assign a value to or nullify the symbolic parameter, the system will process it as a temporary data set name.

So change your file allocation to either have 2 or 1 ampersand.

Code:

//HEADER   DD DSN=&&HEADER,DISP=(NEW,PASS),SPACE=(CYL,(X,Y),RLSE)
//DETAIL   DD DSN=&&DETAIL,DISP=(NEW,PASS),SPACE=(CYL,(X,Y),RLSE) 
//COMBIN   DD DSN=*.HEADER,VOL=REF=*.HEADER,DISP=OLD
//         DD DSN=*.DETAIL,VOL=REF=*.DETAIL,DISP=OLD


or
Code:

//HEADER   DD DSN=&HEADER,DISP=(NEW,PASS),SPACE=(CYL,(X,Y),RLSE)
//DETAIL   DD DSN=&DETAIL,DISP=(NEW,PASS),SPACE=(CYL,(X,Y),RLSE) 
//COMBIN   DD DSN=*.HEADER,VOL=REF=*.HEADER,DISP=OLD
//         DD DSN=*.DETAIL,VOL=REF=*.DETAIL,DISP=OLD


Hope this helps...

Cheers

kolusu

#43:  Author: nguyenh PostPosted: Wed Jan 12, 2005 3:10 pm
    —
Thanks Kolusu,
Some how, I dont know if it is our installation dependant or what, again I dont know. but whenever I use 2 ampercents, it takes 2 ampercents and convert to 1 ampercent and it fails, i look at other people codes in my shop they all used 4 amps for temp datasets, which will returns 2 amps. Back to my previous question. it seams that when i use this code it works. I need to check it again. Thanks again!

Code:

//DETAIL   DD DSN=&&&&DETAIL,DISP=(NEW,PASS)
//COMBIN   DD DSN=&&&&HDR1,VOL=REF=*.HEADER,DISP=(NEW,PASS)
//   DD DSN=&&&&DET1,VOL=REF=*.DETAIL,DISP=(NEW,PASS)

#44:  Author: nguyenh PostPosted: Fri Jan 14, 2005 3:20 pm
    —
Kolusu,
You are right I can now get it to work with just && instead 4 amps. Thanks a lot.

I have another question, I have problem to find the correct syntax for the following statements? could you please show me how this is done the right way. Thanks you!

Code:

//CON&DSN1 IF ( (&DSN1 EQ 1 OR (&DSN1 EQ 2)) AND
//            (&DSN2 EQ 'OLDLIST' OR (&DSN2 EQ 'NEWLIST' ) ) ) THEN

#45:  Author: kolusuLocation: San Jose PostPosted: Fri Jan 14, 2005 4:07 pm
    —
Quote:

I have another question, I have problem to find the correct syntax for the following statements? could you please show me how this is done the right way. Thanks you!


//CON&DSN1 IF ( (&DSN1 EQ 1 OR (&DSN1 EQ 2)) AND
// (&DSN2 EQ 'OLDLIST' OR (&DSN2 EQ 'NEWLIST' ) ) ) THEN



nguyenh,

I am lost here ! what is the language you are referring to ?

Kolusu

#46:  Author: nguyenh PostPosted: Fri Jan 14, 2005 8:11 pm
    —
Kolusu
Code:

I am lost here ! what is the language you are referring to ?


Smile
I am using JCL. Please forgive me! I am very poor in mainframe skill as you had already seen Smile

I am trying to call 1 skeleton (called skleton B) from another skeleton (skeleton A), I pass 2 variables &DSN1 and &DSN2 to skelton B, in skeleton B, I wanta check to see if &DSN1=1 or 2 and &DSN2="oldlist" or "newlist". I know the syntax i posted in the previous post is not correct. That is just some kinda psuedo code for you to see. Smile

my question is how can put that statement in form of JCL.

If ( (condition1 or condition2) and (condition3 or condition4) )
I tried this but it didn't seem to work:
Code:

//   IF ( (&DSN1 = 1 |  &DSN1 = 2) & (&DSN2 = OLDLIST | &DSN2 = NEWLIST ) ) THEN
// statement...............
//   ENDIF

#47:  Author: nguyenh PostPosted: Fri Jan 14, 2005 8:13 pm
    —
Also how do I expand the if statement more than 2 lines ?

Thanks!

#48:  Author: nguyenh PostPosted: Mon Jan 24, 2005 5:26 pm
    —
Hi all,
Which all the helps you provided, I got the skeleton works as desired.
Below is a working skeleton, I am wondering if there is a cleaner, shorter way that provides the same result? just for your reference the DSN1 contains 1, or 2 and DSN2 contains "NEWOUTLIST", or "OLDOUTLIST"
you should not worry about those variables. Thank you much!

Code:

//**********************************************************************
//*RUN ICETOOL UTILITY TO CONSTRUCT SORT KEYS THEN SORT THE RECORDS
//**********************************************************************
//SORT&DSN1   EXEC PGM=ICETOOL,REGION=512K
//DFSMSG   DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//IPFILE   DD DSN=&USERID..TEMP&DSN1,DISP=SHR
//OPFILE   DD DSN=&USERID..&DSN2,DISP=(OLD,KEEP)
//HEADER   DD DSN=&&HEADER,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//DETAIL   DD DSN=&&DETAIL,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//COMBIN   DD DSN=*.HEADER,VOL=REF=*.HEADER,DISP=OLD
//         DD DSN=*.DETAIL,VOL=REF=*.DETAIL,DISP=OLD
//TEMP1    DD DSN=&&T1,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP2    DD DSN=&&T2,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP3    DD DSN=&&T3,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP4    DD DSN=&&T4,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP5    DD DSN=*.TEMP3,VOL=REF=*.TEMP3,DISP=OLD
//         DD DSN=*.TEMP4,VOL=REF=*.TEMP4,DISP=OLD
//TEMP6    DD DSN=&&T6,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP7    DD DSN=&&T7,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP8    DD DSN=&&T8,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP9    DD DSN=&&T9,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP10   DD DSN=&&T10,
//            DISP=(NEW,PASS),SPACE=(CYL,(10,20),RLSE)
//TEMP11   DD DSN=*.TEMP6,VOL=REF=*.TEMP6,DISP=OLD
//         DD DSN=*.TEMP7,VOL=REF=*.TEMP7,DISP=OLD
//         DD DSN=*.TEMP8,VOL=REF=*.TEMP8,DISP=OLD
//         DD DSN=*.TEMP9,VOL=REF=*.TEMP9,DISP=OLD
//         DD DSN=*.TEMP10,VOL=REF=*.TEMP10,DISP=OLD
//TOOLIN   DD *
   COUNT FROM(IPFILE)
   COPY FROM(IPFILE) USING(CTL1)
   COPY FROM(COMBIN) USING(CTL2)
   SPLICE FROM(TEMP1) TO(TEMP2) -
           ON(87,8,CH) -
           WITH(1,80) -
           WITHALL USING(CTL3)
   COPY FROM(TEMP2) USING(CTL4)
   COPY FROM(TEMP5) USING(CTL5)
   SORT FROM(TEMP11) USING(CTL6)

//CTL1CNTL DD *
   INREC  FIELDS=(1,80,SEQNUM,8,ZD)
   OUTFIL FNAMES=HEADER,
   INCLUDE=(1,1,CH,EQ,C'*'),
   OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H',39,6)
   OUTFIL FNAMES=DETAIL,SAVE,
   OUTREC=(1,88,SEQNUM,8,ZD,C'Z',6X)

//CTL2CNTL DD *
   INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,7)
   OUTFIL FNAMES=TEMP1,
   OUTREC=(1,80,106,6,97,8,89,8)

//CTL3CNTL DD *
   OUTFIL FNAMES=TEMP2,
   OUTREC=(1,86,SEQNUM,7,ZD)

//CTL4CNTL DD *
   OUTFIL FNAMES=TEMP3,
   INCLUDE=(1,1,CH,EQ,C' ',OR,
             77,2,CH,EQ,C'TA',OR,
             77,2,CH,EQ,C'TB',OR,
             77,2,CH,EQ,C'TC'),
   OUTREC=(1,93,2,4,10X)
   OUTFIL FNAMES=TEMP4,SAVE,
   OUTREC=(1,93,1,10,4X)

//CTL5CNTL DD *
   OUTFIL FNAMES=TEMP6,
   INCLUDE=(77,2,CH,EQ,C'TT'),
   OUTREC=(1,103,11,4)

   OUTFIL FNAMES=TEMP7,
   INCLUDE=(77,2,CH,EQ,C'CA'),
   OUTREC=(1,103,73,4)

   OUTFIL FNAMES=TEMP8,
   INCLUDE=(77,2,CH,EQ,C'FM'),
   OUTREC=(1,103,4X)

   OUTFIL FNAMES=TEMP9,
   INCLUDE=(77,2,CH,EQ,C'DL'),
   OUTREC=(1,103,1,4)

   OUTFIL FNAMES=TEMP10,SAVE,
   OUTREC=(1,103,4X)

//CTL6CNTL DD *
   OPTION EQUALS
   INREC FIELDS=(1,107)
   SORT  FIELDS=(81,6,CH,A,
                 94,10,CH,A,
                 77,2,CH,A,
                 104,4,CH,A,
                 79,2,CH,A,
                 87,7,CH,A)
   OUTFIL FNAMES=OPFILE,
   OUTREC=(1,86)
/*


#49:  Author: kolusuLocation: San Jose PostPosted: Tue Jan 25, 2005 9:59 am
    —
nguyenh,

I briefly looked at your JCL. However I cannot suggest a better solution unless I know the requirements.

Please create a new topic with exact requirements and I will post a solution for it.

Make sure that you have the following details in the post.

1. LRECL, RECFM of input and output datasets.
2. Sample Input and desired output
3. Any conditions for including/omitting records

Kolusu



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group