Page 1 of 1

Comparing two feilds in a file - Sort

Posted: Fri Sep 02, 2011 7:39 pm
by Gurugars
Hi ,

I have a requirement in a project .

I have a input file which his FB and lrecl of 424 . I have to use two fields in that file to check a condition say its sorted by address field.

The starting position for the account his 1 and the length his 9 and for address feild his 66 and the length his 192 the address feild occurs 6 times with length of 32 each. in this example i have just given the line 1 of the address.

Sample input file

Code: Select all

Account no       Address line 1     

ABC993267             china
ABC913450             china
ABC113450             china
ABC998740             india
ABC138740             india
ABC923240             india
DEF123423             india
DEF928740             india
GHI912340             usa
GHI992140             usa  
The requirment his If the address is same for 3 or more accounts then i need to have all the accounts which belong to the address displayed but the address feild should be displayed once alone. as follows

Code: Select all

Output

Account                 Address line 1

ABC993267             china
ABC913450             
ABC113450             
ABC998740             india            
ABC138740             
ABC923240             
DEF123423           
DEF928740             
I tried it in Easytrieve but its not successfull . Please advise whether this can be solved by Sort

Thanks in advance

Posted: Fri Sep 02, 2011 10:01 pm
by Frank Yaeger
Here's a DFSORT/ICETOOL job that will do what I think you're asking for:

Code: Select all

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/424)
//OUT DD DSN=...  output file (FB/424)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(66,192,CH) HIGHER(2) USING(CTL1)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,
    IFOUTLEN=424,
    IFTHEN=(WHEN=GROUP,KEYBEGIN=(66,192),PUSH=(425:SEQ=8)),
    IFTHEN=(WHEN=(425,8,ZD,GT,1),OVERLAY=(66:192X))
/*

Posted: Mon Sep 05, 2011 3:26 pm
by Gurugars
I tried the Above and i am getting OUTFIL : Syntax error. I verifed and the syntax seems to be fine . I am not sure what might be issue is. The actual length of the feild his 226 and not 192. so i increased it. Please advice.

Error message:

Code: Select all

CTL1CNTL :                                                  
    OUTFIL FNAMES=OUT,                                      
    IFOUTLEN=424,                                           
    IFTHEN=(WHEN=GROUP,KEYBEGIN=(66,226),PUSH=(425:SEQ=8)), 
                      *                                     
    IFTHEN=(WHEN=(425,8,ZD,GT,1),OVERLAY=(66:226X))         
WER428I  CALLER-PROVIDED IDENTIFIER IS "0001"               
WER268A  OUTFIL STATEMENT  : SYNTAX ERROR                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000               
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE[quote][code][/code]
[/quote]

Posted: Mon Sep 05, 2011 5:34 pm
by dbzTHEdinosauer
you are using syncsort and not dfsort.

Posted: Tue Sep 06, 2011 11:03 pm
by Frank Yaeger
Gurugars,

My job works fine with DFSORT. The WER messages indicate you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

Posted: Thu Sep 08, 2011 8:15 am
by Gurugars
Frank Yaeger wrote:Gurugars,

My job works fine with DFSORT. The WER messages indicate you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

Thanks Frank.. I made some changes and i got my requirment .. I had to add anothe step for doing it .