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 

Merge 2 records as single record using sort

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


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Thu Jun 16, 2005 10:35 am    Post subject: Merge 2 records as single record using sort Reply with quote

Hi,

Please help me getting the solution for the below problem.

File format of input file.

Code:

04  7202009999   RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009999   7202A 121221                       Y


--First 2 character is segment id to idenfity the kind of record.
--Position of account number is fixed for every record. For the above example 7202009999 is an account number.
--Policy number will be there only in 13 type record and policy indicator also. For above eg Policy number is 7202A 121221 & Indicator is Y .

Requirements
1) Fetch the accout,policy number and customer mailing information only if Segement 13 policy indicator = "Y".
2) Skip the complete records for a particular account if indicator value in segment 13 is SPACES.

Output :
Single record with account, policy and mailing info.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Jun 16, 2005 10:49 am    Post subject: Reply with quote

What is the RECFM and LRECL of your input file? Please show exactly what you want the output record to look like.

Your points 1 and 2 are rather confusing. 1 seems to say that you only want accounts where the 13 segment has 'Y' in the indicator value. But 2 says to skip the record for accounts where the 13 segment has SPACES in the indicator value.
Seems like rule 1 includes rule 2 - since we're only interested in accounts with a 'Y', we're not interested in any other accounts including those with a SPACE. Or am I misinterpreting what you mean?

It would help if you showed a larger sample of input records and output records.
_________________
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
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 16, 2005 10:49 am    Post subject: Reply with quote

Rahull,

So your output should be as follows?

Code:

7202009999   7202A 121221 RAHUL BANSAL 3131 BETHEL ROAD  COL


Also couple of questions.

1. What is the lrecl/recfm of the file?
2. Can the mailing address span multiple lines?
3. what is the max length of the mailing address?

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


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Thu Jun 16, 2005 12:57 pm    Post subject: Reply with quote

Hi,

Sorry for the late reply. I was making sure by talking to my client.

They are open with LRECL of output file. It can be of any length. There would not be any spanning of maling address.

The input file is of LRECL 1200 and RECFM FB.

The file which KOLUSU comes up is the final output file I want.
Back to top
View user's profile Send private message
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Thu Jun 16, 2005 1:01 pm    Post subject: Reply with quote

Hi Frank,

See the sample records of input file

04 7202009991 RAHUL BANSAL 3131 BETHEL ROAD COL....
13 7202009991 7202A 121221 Y
04 7202009992 RAHUL BANSAL 3131 BETHEL ROAD COL....
13 7202009992 7202A 121222 Y
04 7202009993 RAHUL BANSAL 3131 BETHEL ROAD COL....
13 7202009993 7202A 121223
04 7202009994 RAHUL BANSAL 3131 BETHEL ROAD COL....
13 7202009994 7202A 121224 Y

The output file will be
7202009991 7202A 121221 RAHUL BANSAL 3131 BETHEL ROAD COL
7202009992 7202A 121222 RAHUL BANSAL 3131 BETHEL ROAD COL
7202009994 7202A 121224 RAHUL BANSAL 3131 BETHEL ROAD COL


It should not have record for 7202009993 as it does not have Y in his sement 13 record.

Hi Kolusu,
The maximum legth of mailing address will be 130
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 16, 2005 1:18 pm    Post subject: Reply with quote

Rahull,

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.

Here are some of the assumptions I made.

Code:

record-id      pic x(02) starts at pos 1
Account-no     Pic x(10) starts at pos 5.
Address/policy-no  pic x(30) starts at pos 20
valid-rec id   pic x(01) starts at pos 55.


Code:

//STEP0100 EXEC PGM=ICETOOL
//DFSMSG   DD SYSOUT=*     
//TOOLMSG  DD SYSOUT=*     
//IN       DD *                                         
04  7202009999     RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009999     7202A 121221                       Y 
04  1234567890     KOLUSU MVSFORUMS.COM              ....
13  1234567890     12345 333333                       N 
04  1111111111     CHRISTIAN BALE IN BATMAN BEGIN    ....
13  1111111111     JUNE15TH2005                       Y 
//ID       DD DSN=&ID,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//ADR      DD DSN=&ADR,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//CON      DD DSN=*.ID,VOL=REF=*.ID,DISP=OLD             
//         DD DSN=*.ADR,VOL=REF=*.ADR,DISP=OLD           
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                   
  COPY FROM(IN)  USING(CTL1)       
  SPLICE FROM(CON) TO(OUT) -       
          ON(1,10,CH) -           
          WITH(1,42) -             
          WITHALL                 
//CTL1CNTL DD *
  OUTFIL FNAMES=ID,INCLUDE=(1,2,CH,EQ,C'04'),
  OUTREC=(05,10,     $ ACT-NO
          X,         $ FILLER
          30X,       $ SPACE OF POLICY
          X,         $ FILLER
          20,30)     $ ADDRESS
  OUTFIL FNAMES=ADR,INCLUDE=(01,2,CH,EQ,C'13',AND,
                             55,1,CH,EQ,C'Y'),
  OUTREC=(05,10,     $ ACT-NO
          X,         $ FILLER
          20,30,     $ POLICY-NO
          X,         $ FILLER
          30X)       $ SPACE OF ADDR
/*


The output from this job is

Code:

1111111111 JUNE15TH2005                   CHRISTIAN BALE IN BATMAN BEGIN 
7202009999 7202A 121221                   RAHUL BANSAL 3131 BETHEL ROAD   


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
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 16, 2005 1:26 pm    Post subject: Reply with quote

Rahull,

A tip that might help us both in future. Whenever you post a question seeking help, please post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
Provide as much information as you can.

It only takes 5 mins for me to come up with a solution(provided I can solve it), but it takes hours trying to customize the solution to fit the newly appended requirements.

Without complete details you are wasting your time as well as other people's time who come here to help.

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: Thu Jun 16, 2005 2:45 pm    Post subject: Reply with quote

Rahull,

Here's a DFSORT/ICETOOL job that does this a little more easily and efficiently using DFSORT's new IFTHEN function. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's new IFTHEN function. Only DFSORT has this function, so if you don't have DFSORT, you won't be able to use it. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD *
04  7202009991     RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009991     7202A 121221                       Y
04  7202009992     RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009992     7202A 121222                       Y
04  7202009993     RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009993     7202A 121223
04  7202009994     RAHUL BANSAL 3131 BETHEL ROAD  COL....
13  7202009994     7202A 121224                       Y
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT      DD SYSOUT=*
//TOOLIN   DD *
  COPY FROM(IN)  TO(T1) USING(CTL1)
  SPLICE FROM(T1) TO(OUT) -
          ON(1,10,CH) -
          WITHALL -
          WITH(1,42)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'04'),
    BUILD=(05,10,X,30X,X,20,30)),
   IFTHEN=(WHEN=(01,2,CH,EQ,C'13',AND,
                  55,1,CH,EQ,C'Y'),
    BUILD=(05,10,X,20,30,X,30X))
/*

_________________
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
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Fri Jun 17, 2005 8:58 am    Post subject: Reply with quote

Thanks for the solution.

Its working and I am reading some manual to understand more about SPLICE so that I can very well explain it to my client also.

One quick question: Could you please tell me one thing ? Is there any way to avoid duplicate while creating the temporary files.

I have customized the creation of both temp files but would like to add feature so that I dont have any duplicates in both of my temp file.
Back to top
View user's profile Send private message
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Fri Jun 17, 2005 11:12 am    Post subject: Reply with quote

Hi,

I am running the SYNCTOOL in deveopment and production environment successfully.

But Client is asking for libraries/modules where they can look and can get ensurity that the JCL does not abend while running in CA7.

In SYSOUT , following is the only sentence I found to convince my client.

SYT000I SYNCTOOL RELEASE 1.4D - COPYRIGHT 2003 SYNCSORT INC.

Please tell me system table or some load module which I can show to the client, which SYNCTOOL load is present.

Hi Kolusu, I am sorry that I didn't put this one in my previous query. Client need some kind of evidence and they have called up just now.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jun 17, 2005 11:31 am    Post subject: Reply with quote

Rahull,

Please search before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=3036&highlight=load

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
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Fri Jun 17, 2005 11:36 am    Post subject: Reply with quote

Hi Kolusu,

I am sorry for that. But I am afraid how that link is co-related to my dount ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jun 17, 2005 11:45 am    Post subject: Reply with quote

Quote:

I am sorry for that. But I am afraid how that link is co-related to my dount ?



Rahull,

*Sigh* Evil or Very Mad Your prior question was

Quote:

Please tell me system table or some load module which I can show to the client, which SYNCTOOL load is present.


And the answer to the question is in the link I provided

Type

TSO ISRDDN at your command prompt and press enter

It will bring up all your Current Data Set Allocations

Now type LOAD SYNCTOOL at your command prompt and press enter

This will bring something like this

Code:

Module    SYNCTOOL was found to be already loaded. Note that         
invocations of this program name may pick up another copy from   
STEPLIB or a LIBDEF'ed data set or from a tasklib such as ISPLLIB.
Tab to a box and press enter to view the module in storage.       
      +-------------------------------+
      |    Job pack area resident    |
      |    Loaded by program fetch   |
      |     from -LNKLST- (Lib 79)   |
      |    xxxxx.SYNCSORT.xxxx.xxx   |
      |     LINK                     |
      |    Module address:00088718   |
      |    Module size:   0000D8E8   |
      |    Not loadable only         |
      |    AMODE ANY                 |
      |    Authorized library     |
      +-------------------------------+
                                          


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
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