Comparing two feilds in a file - Sort

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
Gurugars
Active Member
Posts: 107
Joined: Sat Oct 23, 2010 2:17 pm
Location: Chennai,India.

Comparing two feilds in a file - Sort

Post by Gurugars » Fri Sep 02, 2011 7:39 pm

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
Guru:-)

You're never fully dressed without a smile :)

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Sep 02, 2011 10:01 pm

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))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
Gurugars
Active Member
Posts: 107
Joined: Sat Oct 23, 2010 2:17 pm
Location: Chennai,India.

Post by Gurugars » Mon Sep 05, 2011 3:26 pm

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]
Guru:-)

You're never fully dressed without a smile :)

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon Sep 05, 2011 5:34 pm

you are using syncsort and not dfsort.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Sep 06, 2011 11:03 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
Gurugars
Active Member
Posts: 107
Joined: Sat Oct 23, 2010 2:17 pm
Location: Chennai,India.

Post by Gurugars » Thu Sep 08, 2011 8:15 am

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 .
Guru:-)

You're never fully dressed without a smile :)

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others