Sorting and joining of records.

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
Deception 2010
Member
Posts: 3
Joined: Sat Nov 13, 2010 11:40 pm
Location: India

Sorting and joining of records.

Post by Deception 2010 » Sat Nov 13, 2010 11:58 pm

Hi,

Hi,
I need small assistance regarding Sort :

My requirements are as below:

Input File:

Code: Select all


NAA0010000 
NAA0020000 
NAA003NEWA 
NAA0010001 
NAA0020000 
NAA003    
NAA0010000 
NAA0020000 
NAA003    

Input file is a FB file with LRECL of 160 and its starting records are of three types(Length of all would be 160 ).
Type 1 :Starts with NAA001
Type 2 :Starts with NAA002
Type 3 Starts with :NAA003

Desired Output:

Code: Select all

"Record 1 -160bytes record"|"Record Type 2" - 160 byte|"Record Type 3" 
"Record 1 -160bytes record"|"Record Type 2" - 160 byte|"Record Type 3" 
I Output we should have the 3 type of records together differentiated by a pipe.

There are also some conditions as below:
1.)IF all three records Rec1, rec2, rec3 are present consecutively they should be together in the output.
2.) If rec1 is present and rec 2 (or rec3) not present, we should have 160 spaces for that record at their respective place.
3.) If rec1 is not present there should be 160 spaces at the rec1 place and whatever record is present next it should be available at the particular row.

I have also managed to get all the three records (but without condition):
for checking the records and giving the spaces.
Code:

Code: Select all


//STEP01   EXEC  PGM=ICETOOL                                        
//TOOLMSG DD SYSOUT=*                                                
//DFSMSG  DD SYSOUT=*                                                
//IN   DD DSN=XXXX.AAA,DISP=SHR      
//OUT  DD DSN=XXXX.BBB,                      
//             DISP=(NEW,CATLG,DELETE),                              
//             DCB=(RECFM=FB,LRECL=480,BLKSIZE=0),                  
//             UNIT=PRODA,                                          
//             SPACE=(CYL,(100,50),RLSE)                            
//TOOLIN DD *                                                        
 SPLICE FROM(IN) TO(OUT) ON(481,8,CH) KEEPNODUPS WITHEACH -          
  WITH(161,160) WITH(321,160) USING(CTL1)                            
/*                                                                  
//CTL1CNTL DD *                                                      
  INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(481:ID=8,SEQ=1)),        
        IFTHEN=(WHEN=(489,1,ZD,EQ,2),BUILD=(161:1,160,481:481,8)),  
        IFTHEN=(WHEN=(489,1,ZD,EQ,3),BUILD=(321:1,160,481:481,8))    
  OUTFIL FNAMES=OUT,BUILD=(1,480)                                    
/*                                                                  

Could someone assist with the conditions part ??
Thanks,
Deception

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

Post by Frank Yaeger » Mon Nov 15, 2010 10:22 pm

So can you have any combination of the three record types in a group, e.g.

R1,R2 and R3
Just R1
Just R2
Just R3
R1 and R2
R2 and R3
and so on
or only certain combinations (which)?

Please show a better example of input and expected output with different combinations of records for the groups.

Does the output record really have "Record 1 - 160 byte record" with 'Record 1 -' and the quotes? Or does it just have the 160 byte record? Please show the output records as they actually look.
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
Deception 2010
Member
Posts: 3
Joined: Sat Nov 13, 2010 11:40 pm
Location: India

Post by Deception 2010 » Mon Nov 15, 2010 11:45 pm

Hi Frank
Thanks for Replying.:

Yes we Can expect any combination for the records as mentioned by you also:

My input each record has 160 bytes (File is FB with LRECL 160) It is not with quotes.
I have shown my Input File. I am getting it here again :

Code: Select all

NAA0010000221000      51855Q54900029430094300032
NAA0020000UBS FINANCIAL SERVICES INC FBO     JAN
NAA003SAN ANGELO TX  76904-7433                 
NAA0020000STIFEL NICOLAUS & CO INC           A/C
NAA003ST LOUIS MO  63102-2131                   
NAA0010000221000      51855Q54900029430094300032
NAA0010000001000      51855Q57200022850000053138
We can differentiate b\w the three records by NAA001 , NAA002 and NAA003 as characters in first six place always.

Expected O\p Records would be

Code: Select all

NAA0010000221000      NAA0020000        NAA003SAN ANGELO 
 Spaces               NAA00200000       NAA003
NAA001                                            
NAA001
If a particular record is present in Input it would be present in the below record within the same 160 length otherwise there would be blanks(Spaces).

Let me know if it clarifies or if we need some other info.

Thanks a lot.
[/quote]
Live and Let Live :)

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 Nov 16, 2010 2:27 am

The same question was posted on another board asking for a Syncsort solution.
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
Deception 2010
Member
Posts: 3
Joined: Sat Nov 13, 2010 11:40 pm
Location: India

Post by Deception 2010 » Tue Nov 16, 2010 1:56 pm

Thanks Frank ...
NP..
Live and Let Live :)

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