MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

insert using DFSORT/ICETOOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Wed May 05, 2004 5:21 am    Post subject: insert using DFSORT/ICETOOL Reply with quote

Hi All,

I have a particular requirement that has to be met using DFSORT/ICETOOL.
The requirement is as below.

My Input File is as below
===========================
A1 AAA 4030
A1 CCC 2030
A1 DDD 5060
A1 GGG 6010
===========================

My output should be like below
===========================
A1 AAA 4030
A1 BBB 0000
A1 CCC 2030
A1 DDD 5060
A1 EEE 0000
A1 FFF 0000
A1 GGG 6010
===========================

ie my input file has records having a 3 byte values which can be only one of (AAA, BBB, CCC, DDD, EEE, FFF, GGG)
And if in my input file iam not having say 'BBB' i shud insert a record with 'BBB' and with counts 0000 (4 bytes)
In the above example we inserted the records with BBB, EEE and FFF.
In the above example 'A1' is the account number which is same for each record. We can have many other account numbers also like A2, A3 etc..but in each case we need to have all the 6 type of record sets ie. if a particular type of record (AAA, BBB, CCC, DDD, EEE, FFF, GGG) is not present for an account number we need to insert a new record for that account number with that missing type and with count as zeroes.

We can do this through COBOL also but our requirement is for DFSORT/ICETOOL or some utilities.

Any thoughts .....

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 05, 2004 5:26 am    Post subject: Reply with quote

deepeshk79,

Your requirement is similar to the requirement posted in this topic.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1980

Check out the solution posted by me. If you cannot figure out how to do it, then please post the lrecl/recfm of the file and i will post the solution

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Wed May 05, 2004 7:08 am    Post subject: Reply with quote

Thanks Kolusu,

I tried with your solution and it works....

Can you help me out with this one also....

Input File

A1 AAA 4030
A1 BBB 0000
A1 CCC 2030
A1 DDD 5060
A1 EEE 0000
A1 FFF 0000
A1 GGG 6010

Output File
A1 4030 0000 2030 5060 0000 0000 6010
A2.....etc

ie i want all the counts for the account number A1 in one record.

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 05, 2004 7:25 am    Post subject: Reply with quote

Deepesh,

Are you always going to have 7 occurances for each key ? i.e A1 has (AAA thru GGG) will you always have the 7 values or will it be less than that?

If it is always a constant then we override the lrecl and fetch all the rows in a single line. This is a trick messing with the block sizes which some people do not like.

On the other hand if you have DFSORT , the splice operator can be used to get the desired results.

Also there are some dirty ways to get the desired results using sort itself but it has got a lot of limitations.

Let me know if the occurances are constant then I will show you a job which will get the desired results. I also need the lrecl/recfm of input and output datasets.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Wed May 05, 2004 8:25 am    Post subject: Reply with quote

Hi Kolusu,

Yes there will be always 7 occurances.

The LRECL of the input file is 31. The last 9 bytes are the counts. For eg. the input file will be

670010000300032GGGPYSA000..........
670010000300032GGGPYSR000000000
670010000300032GGGPY0100............
890010000300032GGGPY03000000000
890010000300032GGGPY04000.........
890010000300032HHHPY05000..........
890010000300032BBBRTSA00...........----> Note the last 9 digits are packed if they are not zeros.

The last 9 bytes are either zeroes or packed numbers
The first 15 bytes are account numbers.

The output shud have only the 15 byte account number followed by all the 9 bytes counts as shown below

670010000300032...............000000000..............
890010000300032000000000..........................................

The RECFM for both i/p and o/p files are FB.

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Wed May 05, 2004 8:31 am    Post subject: Reply with quote

Hi Kolusu,

Sorry for the confusion. There will be 56 occurances...and not 7. The rest of the details i mentioned above remains the same.

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Wed May 05, 2004 9:43 am    Post subject: Reply with quote

Frank,

Any inputs from your end for 56 occurances?? which means the LRECL will be 15(for ac num) + 56*9(each count=9bytes) = 519

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 05, 2004 10:33 am    Post subject: Reply with quote

Deepesh,

Here is a tricky way of getting the desired results. we first create a dataset with the key and the 9 byte count field , so that the total lrecl (15 + 9 = 24 bytes). I am also hardcoding the blksize on the sortout so that I can override the lrecl in the next step. I have coded blksize=26880.

Now we take the above created file and over ride the LRECL on the sortin statement with 1344.(24 * 56 = 1344)

By doing so we are reading 56 records as a single record. once we have the record as one record all we have to do remove the key value. for that we use the OUTREC.

for ex: if your input is like this.
Code:

AAAAAAAAAAAAAAA       111111111
AAAAAAAAAAAAAAA       222222222
AAAAAAAAAAAAAAA       333333333


By over riding the lrecl sort looks the record as follows
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAAAAAAAAAAAAA111111111AAAAAAAAAAAAAAA222222222AAAAAAAAAAAAAAA333333333


As you see all the records are concatenated one after another. Now using outrec we select the count fields only


Code:

//STEP0100  EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*   
//SORTIN    DD DSN=YOUR INPUT FILE,
//             DISP=SHR
//SORTOUT   DD DSN=&T4,DISP=(,PASS),     
//             SPACE=(CYL,(X,Y),RLSE),   
//             UNIT=SYSDA,BLKSIZE=26880
//SYSIN     DD *           
   INREC FIELDS=(1,15,23,9)
   SORT FIELDS=COPY         
//*
//STEP0200  EXEC  PGM=SORT                 
//SYSOUT    DD SYSOUT=*                   
//SORTIN    DD DSN=&T4,DISP=OLD,LRECL=1344
//SORTOUT   DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),     
//             SPACE=(CYL,(X,Y),RLSE),   
//             UNIT=SYSDA
//SYSIN     DD *
  SORT FIELDS=COPY                                             
  OUTREC FIELDS=(1,15,       $ KEY                             
                 16,9,       $ OCCURANCE # 01                   
                 40,9,       $ OCCURANCE # 02 (40=16 + 24)     
                 64,9,       $ OCCURANCE # 03 (64=40 + 24)     
                 88,9,       $ OCCURANCE # 04                   
                112,9,       $ OCCURANCE # 05                   
                ...                                             
                1336,9)      $ OCCURANCE # 56                   
//*


Hope this helps....

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed May 05, 2004 12:11 pm    Post subject: Reply with quote

Deepesh,

Well, I was thinking you could use the SPLICE operator of DFSORT's ICETOOL with WITHEACH, but you'd need 56 WITH fields and the limit is 50. Also, you'd have to reformat each of the 56 records to get the WITH fields in the right position, which seems kind of impractical. Personally, I'd do this with an E35 exit that had the appropriate logic based on your specific knowledge of what you need to do.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Mon May 10, 2004 5:42 am    Post subject: Reply with quote

Thanks Kolusu and Frank for your prompt reply Smile

It worked great for me !!!

Deepesh
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group