MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Luc Orient Beginner Joined: 30 Apr 2006 Posts: 15 Topics: 4 Location: Paris - France
Posted: Mon Jul 21, 2008 3:06 pm Post subject: Spliting a file like a COBOL OCCURS way
Bonjour de Paris ...
I want to split a file as folows :
Input file (in fact like a COBOL OCCURS file) :
Code: AA000100020003
BB000400050006
Output file :
Code: AA0001
AA0002
AA0003
BB0004
BB0005
BB0005
So, I tried this with the SORT utility :
Code: //SORT EXEC=SORT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=DD1,OUTREC=(1,2,3,4)
OUTFIL FNAMES=DD2,OUTREC=(1,2,7,4)
OUTFIL FNAMES=DD3,OUTREC=(1,2,11,4)
//SORTIN DD *
AA000100020003
BB000400050006
//DD1 DD ...
//DD2 DD ...
//DD3 DD ...
But, with this solution, I have 3 output files instead having only 1.
Of course, I can have a step after to merge the 3 files.
So, in your opinion, is it possible to have only one file as ouput file ?
Thank's in advance ... _________________ I hope my english is not too bad. But it's not my mother tongue.
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jul 21, 2008 3:45 pm Post subject:
You seem not to be aware of the / (new line) function of DFSORT's OUTFIL. You can do what you want using a DFSORT job like this:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AA000100020003
BB000400050006
/*
//SORTOUT DD ...
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(1,2,3,4,/,
1,2,7,4,/,
1,2,11,4)
/*
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
Luc Orient Beginner Joined: 30 Apr 2006 Posts: 15 Topics: 4 Location: Paris - France
Posted: Mon Jul 21, 2008 4:34 pm Post subject:
OK ... merci beaucoup ...
Il will try tomorow when I shall return to my office ... It's the night now in France ... _________________ I hope my english is not too bad. But it's not my mother tongue.
Back to top
Luc Orient Beginner Joined: 30 Apr 2006 Posts: 15 Topics: 4 Location: Paris - France
Posted: Sun Jul 27, 2008 3:09 pm Post subject:
Well ... It's still me and I have a complementary question about my example ...
I want to eliminate the records with a zero value. I am talking about records after the reformat process.
For instance :
_________________ I hope my english is not too bad. But it's not my mother tongue.
Back to top
Luc Orient Beginner Joined: 30 Apr 2006 Posts: 15 Topics: 4 Location: Paris - France
Posted: Sun Jul 27, 2008 3:12 pm Post subject:
... folowing :
Is it possible or should I use another step with a OMIT statement ? _________________ I hope my english is not too bad. But it's not my mother tongue.
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jul 28, 2008 10:44 am Post subject:
Well, it would be easier to use a second pass with an OMIT statement, but you could do it in one pass with a DFSORT job like this:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file (FB/6)
//SYSIN DD *
OPTION COPY
OMIT COND=(3,12,CH,EQ,C'000000000000')
INREC IFTHEN=(WHEN=INIT,OVERLAY=(16:3C'0')),
IFTHEN=(WHEN=(3,4,CH,NE,C'0000'),
OVERLAY=(16:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(7,4,CH,NE,C'0000'),
OVERLAY=(17:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,4,CH,NE,C'0000'),
OVERLAY=(18:C'1'))
OUTFIL IFOUTLEN=6,
IFTHEN=(WHEN=(16,3,CH,EQ,C'111'),
BUILD=(1,2,3,4,/,1,2,7,4,/,1,2,11,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'110'),
BUILD=(1,2,3,4,/,1,2,7,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'101'),
BUILD=(1,2,3,4,/,1,2,11,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'100'),
BUILD=(1,2,3,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'011'),
BUILD=(1,2,7,4,/,1,2,11,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'010'),
BUILD=(1,2,7,4)),
IFTHEN=(WHEN=(16,3,CH,EQ,C'001'),
BUILD=(1,2,11,4))
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
Luc Orient Beginner Joined: 30 Apr 2006 Posts: 15 Topics: 4 Location: Paris - France
Posted: Mon Jul 28, 2008 1:37 pm Post subject:
OK ... Thank's a lot ...
I will use a second pass with an OMIT statement ...
Merci beaucoup pour vos r _________________ I hope my english is not too bad. But it's not my mother tongue.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum