IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

1. Remove duplicates, 2. File formatting based values


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suyash_agrawal

New User


Joined: 27 Nov 2006
Posts: 7
Location: India

PostPosted: Thu Nov 30, 2006 11:37 am
Reply with quote

Hello everyone,

I need your help to achieve the following:

1. Remove duplicates from file based on fragmented key

Input: FB, LRECL-80
Key fields: 4,3,CH & 10,2,CH (Composite)

AAAA111BB22
AAAA222BB34
BBBB111CC22
ABCD222BB33

Output:

AAAA111BB22
AAAA222BB34
ABCD222BB33

Requirement demands that output file should not be sorted.


2. Format file based on field values

Input: FB, LRECL 80

AAAAAAA (6 spaces in front)
BBBBBBBBB (3 spaces in front)
AAAAABB
BBBBDDDDD

Records starting at position 7 will always start with 'A' and those starting at position 4 will always start with 'B'.

Output: (2 spaces in front)

AAAAAAA
BBBBBBBBB
AAAAABB
BBBBDDDDD


Again if this can be done without sorting it'd be great.

Many Thanks,
Suyash
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Nov 30, 2006 11:41 am
Reply with quote

Hi Suyash,

For ur first query
Quote:
1. Remove duplicates from file based on fragmented key

In first step

Code:
//SYSIN    DD  *                   
   INREC FIELDS=(1,80,SEQNUM,8,ZD) 
   SORT FIELDS=(4,3,CH,A,10,2,CH,A)           
   SUM FIELDS=NONE                 
/*

In second step
Code:
//SYSIN    DD  *           
   SORT FIELDS=(81,8,ZD,A) 
   OUTREC FIELDS=(1:1,80)   
/*   


Hope it will helpful
Back to top
View user's profile Send private message
suyash_agrawal

New User


Joined: 27 Nov 2006
Posts: 7
Location: India

PostPosted: Thu Nov 30, 2006 12:13 pm
Reply with quote

Thanks Ekta.

1. The problem i'm facing is that output file should not be sorted and should be in the same order as input with duplicates omitted.

2. The query hasn't come out as intended. Apologies for that. I'll try again:
Format file based on field values

Input: FB, LRECL 80 ('*' - space)

******AAAAAAA
***BBBBBBBBB
******AAAAABB
***BBBBDDDDD

Records starting at position 7 will always start with 'A' and those starting at position 4 will always start with 'B'.

Output:

**AAAAAAA
**BBBBBBBBB
**AAAAABB
**BBBBDDDDD

Again if this can be done without sorting it'd be great.

Cheers!
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Nov 30, 2006 12:31 pm
Reply with quote

Hi Suyash,

It should work as i specified in my prev post to resolve ur first issue we have to use two step in sort first step will remove the duplicate & sort them on concatenated key but we put a counter at 81 byte & in the second step it will put it in the original order according to that counter.
Back to top
View user's profile Send private message
suyash_agrawal

New User


Joined: 27 Nov 2006
Posts: 7
Location: India

PostPosted: Thu Nov 30, 2006 12:51 pm
Reply with quote

Thanks a lot Ekta.
First issue is sorted now. I misunderstood your previous response.

Regards,
Suyash
Back to top
View user's profile Send private message
subhasis_50

Moderator


Joined: 09 Mar 2005
Posts: 363
Location: Earth

PostPosted: Thu Nov 30, 2006 1:41 pm
Reply with quote

Hi,

For your second requirement you can use new JFY function in DFSORT.
Code:

OPTION COPY
INREC BUILD=(1,RECORDLENGTH,JFY=(SHIFT=LEFT,LEAD=C'**'))

Just have a look here
www-03.ibm.com/servers/storage/support/software/sort/mvs/peug/pdf/sortpeug.pdf

Hope it helps
Back to top
View user's profile Send private message
suyash_agrawal

New User


Joined: 27 Nov 2006
Posts: 7
Location: India

PostPosted: Thu Nov 30, 2006 2:31 pm
Reply with quote

Thanks Subhasis.

I tried it but received following error:

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5
OPTION COPY
INREC BUILD=(1,2000,JFY=(SHIFT=LEFT,LEAD=C' '))
?
ICE006A 0 OPERAND DEFINER ERROR


Does it mean that the latest patch might not have been updated in my system?
I've used following JCL:

//CPSD0025 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file
//SORTOUT DD DSN=output file
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,2000,JFY=(SHIFT=LEFT,LEAD=C' '))
/*
//*

Regards,
Suyash
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 30, 2006 9:07 pm
Reply with quote

suyash,

subhasis has the right idea but the actual DFSORT job would be as follows:

Code:

//S1    EXEC  PGM=ICEMAN                     
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD *                               
      AAAAAAA                               
   BBBBBBBBB                                 
      AAAAABB                               
   BBBBDDDDD           
/*                     
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                           
  OPTION COPY                               
  INREC BUILD=(2X,3,78,JFY=(SHIFT=LEFT))     
/*


The error message indicates you don't have z/OS DFSORT V1R5 PTF UK90007 (April, 2006) installed. You need that PTF to use JFY. Ask your System Programmer to install that PTF (it's free).
Back to top
View user's profile Send private message
suyash_agrawal

New User


Joined: 27 Nov 2006
Posts: 7
Location: India

PostPosted: Fri Dec 01, 2006 1:19 pm
Reply with quote

Thank you Frank. I'll try to get it installed.

Regards,
Suyash
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top