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 

Using Sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Fri May 09, 2008 7:01 am    Post subject: Using Sort Reply with quote

Hi ,

I need a help in Using Sort

My Requirement is

I have a file with Account Number , Type

e.g
Code:

Acount   Type
11111    AX
11111    A2
22222    AX
22222    A2
33333    AX

I want the Sort to compare the same Accout and write only the AX type record for the same account , if AX is not present for a account it has to write other type.

Please help.
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri May 09, 2008 7:34 am    Post subject: Reply with quote

Well, you should have posted in the Utilitites section (subtitled: DFSORT/ICEMAN....) BUT do not go and re-post. Your query will be found here.
Ypu will be required to provide other info - LRECL, RECFM, can your input have duplicates - if so show an example not only of the input but the output. If you read these fora regularly you would know these things.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Fri May 09, 2008 8:01 am    Post subject: Reply with quote

Hi Nic,

The input file is sequential and it can have duplicates , Where Account is not only the key. I need to Compare the same account number and then write the record with AX to a extract.

RECFM is VB, LREC = 2000,

Both Account number and type are present for all records in the file in the same Position.
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri May 09, 2008 9:22 am    Post subject: Reply with quote

Can you have multiple AX records for an account? If so, which AX record is to be written? What column is the account number in? Is it Zoned Decimal (i.e. eye readable)? What column is AX in? Whoever answers this for you will really like to see an example, similar to that in your first post, of the input file, with duplicates, and the expected output file.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Mon May 12, 2008 8:12 am    Post subject: Reply with quote

Hi Nic,

There cannot be more than one AX record for an account. The accout number is 9(5).

Thanks for your help.

Regards,
Raj
Back to top
View user's profile Send private message Send e-mail
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Mon May 12, 2008 8:22 am    Post subject: Reply with quote

Nic,

there is a combination which from i need to take.

a account can account type as
ax
a2
a1
a3

presence of ax type record for an account i need to take ax, if ax is not present i need to take a1 type records and write to ouptut.

I have heard Icetool does compare records but not sure how to use it.
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon May 12, 2008 9:20 am    Post subject: Reply with quote

Well, I just got a little confused here - your first post says that if an AX is available then select that otherwise select the A2 record. Your last post says select the A1 record if an AX is not present. Can you please clarify the criteria for selecting another record when a type of AX is not available?

Also, can we assume that the Account is bytes 1-5 of the record and Type is bytes 10 - 11 (5-9 & 14-15 when RDW is included)?

BTW - I won't be giving the solution as I do not know it and, although I have manuals, I do not have a mainframe to play with until I get a new job.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
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: Mon May 12, 2008 10:04 am    Post subject: Reply with quote

Rajkannan,

You're not getting an answer here because you haven't explained clearly what you want to do. If nobody can understand what you want to do, then nobody can provide a solution.

Start over and give an example of the records in your input file and what you expect for output. Explain the "rules" for getting from input to output based on your example. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.
_________________
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
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Thu May 15, 2008 3:26 am    Post subject: Reply with quote

Hi all,

I was preparing a high level solution for requirement. Now i have a detail requirement . While I posted previous question I didn't have complete requirement.

The RECFM is FB, LRECL = 40

scenario 1:
Code:

 ACCT   TYPE  FREQUENCY     
 11111   Z1        Q
 11111   P8        M
 11111   P9        M
 11111   Z1R       Q
 11111   Z1C       Q

I need to process ( write to another extract ) z1,z1r,z1c as they all belong to frequency q and I need to write p8 and ignore p9

scenario 2:
Code:

 ACCT   TYPE  FREQUENCY     
 11111   Z1        M
 11111   P8        Q
 11111   P9        M
 11111   Z1R       Q
 11111   Z1C       Q

I need to process ( write to extract ) p8,z1r,z1c as they all belong to frequency q and aslo write z1 and ignore p9

scenario 3:
Code:

 ACCT   TYPE  FREQUENCY     
 11111   Z1        M
 11111   P8        Q
 11111   P9        Q
 11111   Z1R       M
 11111   Z1C       M

I need to process (write to extract) z1,z1r,z1c as they all belong to frequency M and also write P8 and ignore p9

scenario 4:
Code:

 ACCT   TYPE  FREQUENCY     
 11111   Z1        M
 11111   P8        M
 11111   P9        M
 11111   Z1R       M
 11111   Z1C       M

I need to process (write to extract) z1,z1r,z1c as they all belong to frequency M and ignore p8,p9

scenario 5:
Code:

 ACCT   TYPE  FREQUENCY     
 11111   P8        M
 11111   P9        M

I need to process ( write to extract ) P8, and ignore p9.

Requirement is

1. presence of type z1 for the same account along with p8,p9 with the same frequency then Z1 needs to be written along with z1r,z1c of same frequency ( Scenario 4)

2. presence of type z1 for the same account along with p8,p9 with the different frequency then z1r,z1c needs to be written with matching frequency of z1,p8,p9 ( Scenario 2,Scenario 1,Scenario 3)

3. if only p8 or p9 is present without z1r and z1c . P8 needs to written.
(Scenario 5)

Thanks in advance
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu May 15, 2008 4:01 am    Post subject: Reply with quote

Can we assume that ACCT starts in col 1 length 5 bytes, TYPE starts in col 7 length 3 bytes and FREQUENCY starts col 11 length 1 byte?

Z1 is always to be extracted, P8 is to be extracted if its frequency does not match that of Z1, Z1C and Z1R are to be extracted if their frequency matches that of Z1 or P8 or P9 and P9 is never extracted.?

Can the frequency be any other value e.g. D, W, Y?

Can duplicates of any TYPE exist within an account?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Thu May 15, 2008 5:14 am    Post subject: Reply with quote

Nic,

Thnaks for reply,


Can we assume that ACCT starts in col 1 length 5 bytes, TYPE starts in col 7 length 3 bytes and FREQUENCY starts col 11 length 1 byte?

Yes

Z1 is always to be extracted, P8 is to be extracted if its frequency does not match that of Z1, Z1C and Z1R are to be extracted if their frequency matches that of Z1 or P8 or P9 and P9 is never extracted.?

Yes

Can the frequency be any other value e.g. D, W, Y?

No

Can duplicates of any TYPE exist within an account?

No

Regards,
Raj
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Thu May 15, 2008 10:57 am    Post subject: Reply with quote

Rajkannan,


The following DFSORT/ICETOOL jcl will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL       
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD *                   
11111 Z1  Q                       
11111 P8  M                       
11111 P9  M                       
11111 Z1R Q                       
11111 Z1C Q                       
22222 Z1  M                       
22222 P8  Q                       
22222 P9  M                       
22222 Z1R Q                       
22222 Z1C Q                       
33333 Z1  M                       
33333 P8  Q                       
33333 P9  Q                       
33333 Z1R M                       
33333 Z1C M                       
44444 Z1  M                       
44444 P8  M                       
44444 P9  M                       
44444 Z1R M                       
44444 Z1C M                       
55555 P8  M                       
55555 P9  M                       
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SPLICE FROM(IN) TO(OUT) ON(1,5,CH) WITH(1,40) -               
  WITHALL KEEPBASE USING(CTL1)                                 
//CTL1CNTL DD *                                                 
  SORT FIELDS=(1,5,CH,A,41,3,CH,D)                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:4X)),                     
        IFTHEN=(WHEN=(7,3,CH,EQ,C'Z1 '),OVERLAY=(41:7,3,11,1)),
        IFTHEN=(WHEN=(7,3,CH,EQ,C'P8 '),OVERLAY=(41:7,3,11,1)) 
                                                               
  OUTFIL FNAMES=OUT,BUILD=(01,40),                             
  INCLUDE=((7,2,CH,EQ,41,2,CH),OR,                             
           (7,2,CH,EQ,C'P8',AND,11,1,CH,NE,44,1,CH))           
/*                                                             


The output from this job is

Code:

11111 Z1  Q
11111 P8  M
11111 Z1R Q
11111 Z1C Q
22222 Z1  M
22222 P8  Q
22222 Z1R Q
22222 Z1C Q
33333 Z1  M
33333 P8  Q
33333 Z1R M
33333 Z1C M
44444 Z1  M
44444 Z1R M
44444 Z1C M
55555 P8  M


Hope this helps...

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


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Mon May 26, 2008 10:17 am    Post subject: Reply with quote

Kolusu,

Sorry for delay in reply.

Thanks a lot

Raj
Back to top
View user's profile Send private message Send e-mail
Rajkannan
Beginner


Joined: 02 Jun 2004
Posts: 64
Topics: 31

PostPosted: Tue May 27, 2008 12:00 pm    Post subject: Reply with quote

Kolusu,

Need a favour,

I tested the same today. The scenario I had given it worked fine.

There is also three new scenaio where
Code:

Scenario new1
66666 P8   M
66666 Z1R  Q
66666 Z1C  Q 

Scenario new2
77777 P8   M
77777 Z1R  Q
77777 Z1C  M 

Scenario new3
88888 P9   M
88888 Z1R  Q
88888 Z1C  M 

Scenario new3
88888 P9   M
88888 Z1R  M
88888 Z1C  M 

And all the new scenario also needs to be processed. I tried changing the include could not suceed.

Thanks
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue May 27, 2008 2:53 pm    Post subject: Reply with quote

Rajkannan,

what is the expected output and what are the rules to be followed?

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
Goto page 1, 2  Next
Page 1 of 2

 
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