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

How to split records into three


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Thu Jan 08, 2009 6:30 pm
Reply with quote

I must split records of one line to three lines.

I can have x lines but the record key on 1,4 is unique.

My input (fb lrecl 23) is :
1000 ABC DEF KLM
2000 ABB DCC KCC

My output file must be :
VM04 ABC
VM02 DEF
VM0A KLM
DM04 ABB
DM0B DCC
DM0A KCC


i try this jcl but it is wrong
//IN DD DSN=N4GX.TEMPS.TEST.ICETOOL.FILEA,DISP=SHR
//OUT DD DSN=N4G.TEMPS.TEST.ICETOOL.SORTIE,
// DISP=(MOD,CATLG,DELETE),
// UNIT=WORKP,
// SPACE=(23,(1,1),RLSE),AVGREC=K
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL1)
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL2)
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL3)
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL4)
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL5)
SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL6)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(6,3,CH,EQ,C'ABC'),
BUILD=(1:C'VM04 ',6:6,3))
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=(10,3,CH,EQ,C'DEF'),
BUILD=(1:C'VM02 ',6:10,3))
//CTL3CNTL DD *
INREC IFTHEN=(WHEN=(14,3,CH,EQ,C'KLM'),
BUILD=(1:C'VM0A ',6:14,3))
//CTL4CNTL DD *
INREC IFTHEN=(WHEN=(6,3,CH,EQ,C'ABB'),
BUILD=(1:C'DM04 ',6:6,3))
//CTL5CNTL DD *
INREC IFTHEN=(WHEN=(10,3,CH,EQ,C'DCC'),
BUILD=(1:C'DM0B ',6:10,3))
//CTL6CNTL DD *
INREC IFTHEN=(WHEN=(14,3,CH,EQ,C'KCC'),
BUILD=(1:C'DM0A ',6:14,3))
//*

the output is :

VM04 ABC
2000 ABB DCC KCC
VM02 DEF
2000 ABB DCC KCC
VM0A KLM
2000 ABB DCC KCC
DM04 ABB
1000 ABC DEF KLM
DM0B DCC
1000 ABC DEF KLM
DM0A KCC
1000 ABC DEF KLM

thanks for your help
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Jan 08, 2009 6:48 pm
Reply with quote

farouck,

Do you have input records like this? If yes, post the output for that.
Code:
1000 ABC ABC DEF
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Thu Jan 08, 2009 7:07 pm
Reply with quote

Hi arcvns,

It is not possible.

But the value are not very important, i search how to code the jcl to split the records
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Jan 08, 2009 9:43 pm
Reply with quote

Almost. Got the required records, but not in the order you wanted. If it's important, a little more work should get you the right order.

Code:
//OUT DD DISP=(,PASS),DSN=&&F00,UNIT=VIO,SPACE=(TRK,1)     
//F01 DD DISP=(,PASS),DSN=&&F01,UNIT=VIO,SPACE=(TRK,1)     
//F02 DD DISP=(,PASS),DSN=&&F02,UNIT=VIO,SPACE=(TRK,1)     
//F03 DD DISP=(,PASS),DSN=&&F03,UNIT=VIO,SPACE=(TRK,1)     
//TOOLIN DD *                                               
  SELECT FROM(IN) TO(OUT) ON(1,4,CH) NODUPS USING(CTL1)     
/*                                                         
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=F01,IFTHEN=(WHEN=(6,3,CH,EQ,C'ABC'),       
          BUILD=(1:C'VM04 ',6:6,3)),                       
         IFTHEN=(WHEN=(6,3,CH,EQ,C'ABB'),                   
          BUILD=(1:C'DM04 ',6:6,3))                         
  OUTFIL FNAMES=F02,IFTHEN=(WHEN=(10,3,CH,EQ,C'DCC'),       
          BUILD=(1:C'DM0B ',6:10,3)),                       
         IFTHEN=(WHEN=(10,3,CH,EQ,C'DEF'),                 
          BUILD=(1:C'VM02 ',6:10,3))                       
  OUTFIL FNAMES=F03,IFTHEN=(WHEN=(14,3,CH,EQ,C'KLM'),       
          BUILD=(1:C'VM0A ',6:14,3)),                       
         IFTHEN=(WHEN=(14,3,CH,EQ,C'KCC'),                 
          BUILD=(1:C'DM0A ',6:14,3))                       
//*                                                         
//GEN EXEC PGM=IEBGENER                                     
//SYSPRINT DD SYSOUT=*                                     
//SYSIN DD DUMMY                                           
//SYSUT2 DD SYSOUT=*                                       
//SYSUT1 DD DSN=&&F01,DISP=(OLD,PASS)                       
//       DD DSN=&&F02,DISP=(OLD,PASS)     
//       DD DSN=&&F03,DISP=(OLD,PASS)     


Hope this is of use....

Garry.
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Thu Jan 08, 2009 10:14 pm
Reply with quote

thanks gary,

Yes the order is not good, but i'm going to modified it.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Jan 08, 2009 10:14 pm
Reply with quote

farouck,

I doubt that all of those SELECT statements or all of those OUTFIL statements are needed, but I can't tell you how to do what you want in a better way until you explain more clearly what you're trying to do exactly.

If you just want to split each record into three records, you can do it with a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN                   
//SYSOUT    DD  SYSOUT=*                   
//SORTIN DD *                               
1000 ABC DEF KLM                           
2000 ABB DCC KCC                           
/*
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                         
  OPTION COPY                               
  OUTFIL BUILD=(6:6,3,/,6:10,3,/,6:14,3)   
/*


SORTOUT would have:

Code:

     ABC 
     DEF 
     KLM 
     ABB 
     DCC 
     KCC 


But you show different values for the different records (e.g. VM04 for the first record, VM02 for the second record, etc). It isn't clear where those values come from. Is each value associated with a particular string (e.g. VM04 for 'ABC', VM02 for 'DEF', etc) or are the values selected some other way (how)? Please explain the "rules" for picking these values.
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Mon Jan 12, 2009 7:01 pm
Reply with quote

frank,

If you agree i give you another sample, it is very different but it is more useful for me:

My iput file (lrecl 18 FB) is :
1000 150,00 140,10
2000 000,00


When on 6,6 the record is equal zero i write VM04 instead of the key, i write the first record on 6,6 and i add U after.
When on 6,6 the record is numeric i write VM04 instead of the key, i write the first record on 6,6 and i add N after.
When on 6,6 the record is not numeric i write nothing

When on 13,6 the record is equal zero i write VM06 instead of the key, i write the first record on 6,6 and i add U after.
When on 13,6 the record is numeric i write VM06 instead of the key, i write the first record on 6,6 and i add N after.
When on 13,6 the record is not numeric i write nothing

The ouput file must be :

VM04 150,00N
VM06 140,10N
VM04 000,00U

In reality I have more columns and records are packed decimal PD.
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Mon Jan 12, 2009 8:22 pm
Reply with quote

To do that, i wrote this jcl but we can do better?
//S1 EXEC PGM=ICEMAN
//SORTIN DD *
1000 150,00 140,10
2000 000,00
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=N4GX.TEMPS.TEST.ICETOOL.SORTIE,
// DISP=(,CATLG,DELETE),
// LRECL=11,
// RECFM=FB,
// UNIT=WORKP,
// SPACE=(11,(1,1),RLSE),AVGREC=K
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(1:C'VM04 ',6:6,6,/1:C'VM06 ',6:13,6)
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//IN1 DD DSN=N4GX.TEMPS.TEST.ICETOOL.SORTIE,
// DISP=SHR
//OUT DD DSN=N4GX.TEMPS.TEST.ICETOOL.SORTIE2,
// DISP=(,CATLG,DELETE),
// LRECL=12,
// RECFM=FB,
// UNIT=WORKP,
// SPACE=(12,(1,1),RLSE),AVGREC=K
//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'000,00'),
BUILD=(1:1,11,12:C'N')),
IFTHEN=(WHEN=(6,6,ZD,GT,0),
BUILD=(1:1,11,12:C'U')),
IFTHEN=(WHEN=(6,6,CH,EQ,C' '),
BUILD=(1:C'BYPASS RECORD'))
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jan 12, 2009 10:17 pm
Reply with quote

Since you say the fields are PD, let's work with PD fields in 6,6 and 13,6.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file (FB/18)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/12)
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,BUILD=(1:C'VM04 ',6:6,6,/1:C'VM06 ',6:13,6)
/*
//CTL2CNTL DD *
  OMIT COND=(6,6,PD,NE,NUM)
  INREC IFTHEN=(WHEN=(6,6,PD,EQ,0),OVERLAY=(12:C'U')),
    IFTHEN=(WHEN=NONE,OVERLAY=(12:C'N'))
/*
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Thu Jan 15, 2009 9:05 pm
Reply with quote

Thanks you Franck,

It is better
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top