Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Spliting the duplicate file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
itsurfrank

New User


Joined: 31 Aug 2009
Posts: 6
Location: India

PostPosted: Fri Jul 09, 2010 6:04 pm    Post subject: Spliting the duplicate file
Reply with quote

Could you please help me to do this...

i/P File.. :

A,B,C
1
1
1
2
2
2
3
3
3


o/p File :

A
1
2
3
B
1
2
3
C
1
2
3

Thanks in Advance...
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Jul 09, 2010 8:56 pm    Post subject:
Reply with quote

It's not at all clear what you want to do.

You need to explain the rules for getting from that input to that output.

Is that the way the actual input and output records look? What is the pattern of the input records - does it repeat?

Give the RECFM and LRECL of the input file. Give the starting position, length and format of the relevant fields.
Back to top
View user's profile Send private message
itsurfrank

New User


Joined: 31 Aug 2009
Posts: 6
Location: India

PostPosted: Sat Jul 10, 2010 7:17 pm    Post subject: Reply to: Spliting the duplicate file
Reply with quote

Thanks for your quick response Frank !!! icon_smile.gif

1. Yes Frank each record will be repeated based on the number of headers(here it is A B C)
2. No keys just duplicates
3. RECFM = FB
LRECL = 80

Input File :

A B C
111111111
111111111
111111111
2222222
2222222
2222222
33333
33333
33333


o/p File :

A
111111111
2222222
33333
B
111111111
2222222
33333
C
111111111
2222222
33333

Logic to be implemented:

Actually , the input file will have the header's in the first row of the file.The details record are in such a way that if there is 3 header, then each record will be duplicated 3 time.(as above)

My requirement is to split this input file into 3 blocks as we have 3 headers.Every block will be same (as every records will be available in every block)

Expecting your kind response !!! Hope u ll help me in this regards,

Thanks,
Frank.G
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon Jul 12, 2010 8:42 pm    Post subject:
Reply with quote

Quote:
The details record are in such a way that if there is 3 header, then each record will be duplicated 3 time.


And if there are 4 headers, then each record will be duplicated 4 times? And so on? Or is there always just 3 headers?

The records with the headers is always the FIRST record?

What is the maximum number of headers? Is the length of each header really 1 byte? If not, what does the header record really look like? How do we identify one header from the next (specific positions, a delimiter, something else)?
Back to top
View user's profile Send private message
itsurfrank

New User


Joined: 31 Aug 2009
Posts: 6
Location: India

PostPosted: Tue Jul 13, 2010 11:58 am    Post subject: Reply to: Spliting the duplicate file
Reply with quote

Hi,

Please find below my answers for your query.

And if there are 4 headers, then each record will be duplicated 4 times?
Exactly ... Frank.

Is there always just 3 headers?
No.Header will be maximum of 10.The duplication of record is based upon the header.i.e if n headers then n time the records are duplicated.

The records with the headers is always the FIRST record?
Yes.

What is the maximum number of headers?
10 headers.

Is the length of each header really 1 byte?
No.

If not, what does the header record really look like?
8 bytes . ( eg : MEM0FOI0)


How do we identify one header from the next (specific positions, a delimiter, something else)?

delimiter is used Frank. Its comma (MEM0FOI0,MEM0FOI1,MEM0FOI2...)

Sorry for the inconvienece made !!

Hope i have answered you clearly !!! let me know if u want more clarifcation ...

Thanks,
Frank.G.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Jul 14, 2010 1:12 am    Post subject:
Reply with quote

Before I spend time on this, I want to make sure I understand what you want.

You show the example header record as:

MEM0FOI0,MEM0FOI1,MEM0FOI2

where each header is 8 bytes. This looks like fixed positions (first header in 1-8, second header in 10-17, etc).

But is it really comma delimited where a header can be 1-8 bytes, for example,

MEM0,B,MEM0FOI2

I need to know exactly what the first record can look like in order to show you how to do this correctly.
Back to top
View user's profile Send private message
itsurfrank

New User


Joined: 31 Aug 2009
Posts: 6
Location: India

PostPosted: Wed Jul 14, 2010 9:27 am    Post subject: Reply to: Spliting the duplicate file
Reply with quote

Frank,

In technical terms its mailbox id(MEM0FOI0).It will be always 8 bytes of length.

1------8,10-----17,19------26 and soon.

Thanks,
Frank.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 14, 2010 10:49 pm    Post subject:
Reply with quote

itsurfrank,

You can only have 9 headers within a LRECL of 80 as you have a delimiter between each header value.

The following DFSORT JCL will give you the desired results.
Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your input FB 80 byte lrecl file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),           
  IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(101:1,80)),     
  IFTHEN=(WHEN=INIT,OVERLAY=(90:SEQNUM,8,ZD,RESTART=(1,80))),   
  IFTHEN=(WHEN=GROUP,BEGIN=(90,8,ZD,EQ,1),PUSH=(81:ID=8)),     
  IFTHEN=(WHEN=(81,8,ZD,EQ,2),OVERLAY=(90:101,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,3),OVERLAY=(90:110,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,4),OVERLAY=(90:119,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,5),OVERLAY=(90:128,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,6),OVERLAY=(90:137,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,7),OVERLAY=(90:146,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,8),OVERLAY=(90:155,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,9),OVERLAY=(90:164,8)),             
  IFTHEN=(WHEN=(81,8,ZD,EQ,10),OVERLAY=(90:173,8))             
                                                               
  OUTFIL STARTREC=2,BUILD=(1,80),                               
  REMOVECC,SECTIONS=(90,8,HEADER3=(90,8))                       
//*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Jul 15, 2010 3:54 pm    Post subject:
Reply with quote

Hi Kolusu,

I know you do test your solutions before posting and it may be due to my lack of subject knowledge.

Here the expected output record order is different from that of the input. Will the above solution with SORT FIELDS=COPY take care of this?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 15, 2010 9:55 pm    Post subject:
Reply with quote

Arun Raj,

Oops Sorry. I didn't notice that OP wanted the output also sorted. For some reason I thought he just wanted to Push the header on to the duplicated rows. My bad. Thanks for pointing it out.

Here are the updated control cards which would give him the desired results.


Code:

//SYSIN    DD *                                             
  SORT FIELDS=(90,8,CH,A),EQUALS                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
  IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(101:1,80)),
  IFTHEN=(WHEN=INIT,OVERLAY=(90:SEQNUM,8,ZD,RESTART=(1,80)))
                                                           
  OUTREC IFTHEN=(WHEN=(90,8,ZD,EQ,1),OVERLAY=(81:101,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,2),OVERLAY=(81:110,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,3),OVERLAY=(81:119,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,4),OVERLAY=(81:128,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,5),OVERLAY=(81:137,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,6),OVERLAY=(81:146,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,7),OVERLAY=(81:155,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,8),OVERLAY=(81:164,8)),   
         IFTHEN=(WHEN=(90,8,ZD,EQ,9),OVERLAY=(81:173,8))   
                                                           
  OUTFIL STARTREC=2,BUILD=(1,80),                           
  REMOVECC,SECTIONS=(90,8,HEADER3=(81,8))                   
//*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sat Jul 17, 2010 10:52 am    Post subject:
Reply with quote

Skolusu wrote:
Thanks for pointing it out.
It happens at times. You're welcome icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us