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

Combine the same file using keys :


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vpalanivelu

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Mon Apr 20, 2009 6:09 pm
Reply with quote

Input - FB/80

Code:


ID : ABC       /* KEY */
A123
A345
ID : ABC       /* KEY */
678H
T789
ID : CDE       /* KEY */
F768
T789
U890
ID : CDE       /* KEY */
G890
7890
ID : FGH        /* KEY */
6789
ID : IJK        /* KEY */
8990
0569


Output FB/80

Code:


ABC   A123
ABC   A345
ABC   678H
ABC   T789
CDE   F768
CDE   T789
CDE   U890
CDE   G890
CDE   7890
FGH   6789
IJK   8990
IJK   0569


The key (1,3) position however in some records it wnt be there. Once it got changed we need to group them in to other. with the word "ID :" we can identify the key. Please look over this !
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Apr 20, 2009 6:33 pm
Reply with quote

Hi below solution will give you required output...
but please not that as you have mentioned op as FB and lrecl=80,
and in output you want 3bytes of from header and 3 spaces after that,
you will loose last 6 bytes of detail line from input file..
Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD *             
ID : ABC       /* KEY */     
A123                         
A345                         
ID : ABC       /* KEY */     
678H                         
T789                         
ID : CDE       /* KEY */     
F768                         
T789                         
U890                         
ID : CDE       /* KEY */     
G890                         
7890                         
ID : FGH        /* KEY */                                           
6789                                                                 
ID : IJK        /* KEY */                                           
8990                                                                 
0569                                                                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'ID :'),PUSH=(81:6,3)),
        IFTHEN=(WHEN=NONE,BUILD=(81,3,3X,1,74))                     
  OUTFIL INCLUDE=(7,4,CH,NE,C'ID :')                                 
/*                                                                   
Back to top
View user's profile Send private message
vpalanivelu

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Mon Apr 20, 2009 8:04 pm
Reply with quote

I'm getting a SYNTAX error in INREC. I ve used the same code
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Apr 20, 2009 8:13 pm
Reply with quote

vpalanivelu wrote:
I'm getting a SYNTAX error in INREC. I ve used the same code
Post your output.
Back to top
View user's profile Send private message
vpalanivelu

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Mon Apr 20, 2009 8:15 pm
Reply with quote

we are having 1 SYNCSORT FOR Z/OS 1.2.2.1R .. will it support WHEN=GROUP, If not plz provide some other solutions
Back to top
View user's profile Send private message
vpalanivelu

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Mon Apr 20, 2009 8:20 pm
Reply with quote

Code:

 SYNCSORT FOR Z/OS  1.2.2.1R    U.S. PATENTS: 4210961, 5117495   (C)
                                            SYSIN :                                                             
   SORT FIELDS=COPY                                                 
   INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'ID :'),PUSH=(81:6,3)),
        *                                                           
         IFTHEN=(WHEN=NONE,BUILD=(81,3,3X,1,74))                     
   OUTFIL INCLUDE=(7,4,CH,NE,C'ID :')                               
 WER268A  INREC STATEMENT   : SYNTAX ERROR                           
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                       
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                       
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Apr 20, 2009 8:26 pm
Reply with quote

Since IFTHEN is not available on you old release, try TRAILER3.......
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Apr 20, 2009 10:24 pm
Reply with quote

IFTHEN is supported in SyncSort for z/OS 1.2.2.1. However, support for WHEN=GROUP was included as of SyncSort for z/OS 1.3.2.0.
Back to top
View user's profile Send private message
vpalanivelu

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Tue Apr 21, 2009 1:48 pm
Reply with quote

IFTHEN is permitted however WHEN=GROUP is not supporting as we are using older version. I ve done with that by easytrieve.
Thank you one and all.
One more question usign TRAILER3 we can have the totals by SECTIONS right? How it will be helped here ?
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top