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

splitting of files according to condition


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

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 1:43 pm
Reply with quote

Hi,

I have posted this requirement already its splitting i/p file into exactly half.
But condition is.. I have my i/p file records of 37 > 30000 cond'n is wrong so it should bypass 1st 2 steps and execute only last step.
in similar way, if i have i/p file has records 35000 > 30000 here cond'n is right so it should split file. in first two steps and bypass 3rd step.

Hope am clear with requirement.

here my JCL included.

//STEP01 EXEC PGM=SORT,PARM='VLTESTI=1'
//SYSOUT DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(,PASS)
//SORTIN DD DSN=OSBS.ECOMERCE.SNGLFEED.TO.EDI,DISP=SHR
//SYSIN DD *
OPTION COPY
INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,30000)
OUTFIL FNAMES=T1,NULLOFL=RC4,
BUILD=(C'CNT,',37,9,ZD,DIV,+2,M11,LENGTH=9,80:X),CONVERT
//********************************************************************
//STEP02 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN DD DSN=OSBS.ECOMERCE.SNGLFEED.TO.EDI,DISP=SHR
//OUT1 DD DSN=BO1142.OSBS.TEST.ECOMERCE.SNGLFEED.TO.EDI1,
// DISP=(NEW,CATLG),
// DCB=(RECFM=VB,LRECL=744,BLKSIZE=0),
// SPACE=(CYL,(25,25),RLSE)
//OUT2 DD DSN=BO1142.OSBS.TEST.ECOMERCE.SNGLFEED.TO.EDI2,
// DISP=(NEW,CATLG),
// DCB=(RECFM=VB,LRECL=744,BLKSIZE=0),
// SPACE=(CYL,(25,25),RLSE)
//SYSIN DD *
OPTION COPY
OMIT COND=(5,3,CH,EQ,C'END')
INREC BUILD=(1,4,SEQNUM,9,ZD,14:5)
OUTFIL FNAMES=OUT1,REMOVECC,
INCLUDE=(5,9,ZD,LE,CNT),BUILD=(1,4,5:14),
TRAILER1=(C'END FEED=ORDER CLIENT=301 LINES=',COUNT+1=(M11,LENGTH=9))
OUTFIL FNAMES=OUT2,REMOVECC,
INCLUDE=(14,3,CH,EQ,C'BEG',OR,5,9,ZD,GT,CNT),BUILD= (1,4,5:14),
TRAILER1=(C'END FEED=ORDER CLIENT=301 LINES=',COUNT+1=(M11,LENGTH=9))
//***********************************************************
//STEP03 EXEC PGM=SORT,COND=(4,GT)
//SYSOUT DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(,PASS)
//SORTIN DD DSN=OSBS.ECOMERCE.SNGLFEED.TO.EDI,DISP=SHR
//SORTOUT DD DSN=BO1142.OSBS.TEST.ECOMERCE.SNGLFEED.TO.EDI0,
// DISP=(NEW,CATLG),
// DCB=(RECFM=VB,LRECL=744,BLKSIZE=0),
// SPACE=(CYL,(25,25),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
/*
**************************** Bottom of Data *******************

Please help me out in this...
Thanks,
snehasai
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 1:56 pm
Reply with quote

Hi,
The condition over here is
INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,30000) is not working i suppose.

IT is just splitting the file even if am having less records or more records also,so i need to split only if my i/p file record count < 30000 other wise it should not split the file and bypass 1st 2 steps and execute only last step.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 5:45 pm
Reply with quote

Hello,

What happened to the other topic where your original requirement was posted ? I just did a search and the topic seems to be just disappeared?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 5:54 pm
Reply with quote

Quote:
INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,30000) is not working i suppose.
Why would you think that it's not working? Please explain the logic you're trying to implement.
Quote:
IT is just splitting the file even if am having less records or more records also,so i need to split only if my i/p file record count < 30000 other wise it should not split the file and bypass 1st 2 steps and execute only last step.

You might have got return codes of '0' and '4' for the two scenarios that can happen. Please note that the actual splitting is done in your 2nd step where you've not given any condition codes and that explains why your file's getting splitted always.
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 5:55 pm
Reply with quote

hi arun,
That was been deleted...by a person as i just asked how to delete..but later asked not to delet as i have queries still on this...but after i saw that
its not present. icon_sad.gif
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 5:59 pm
Reply with quote

So i think that 1st step we can do is count the total num of records in i/p file using
OPTION COPY
OUTFIL NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=9))

and in step02 i can specify condition that if count< 30000 dont split and execute lst step and if count > 30000 execute step2,3 skip last step.
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 6:17 pm
Reply with quote

Code:

//STEP01  EXEC PGM=SORT,PARM='VLTESTI=1'
//SYSOUT    DD SYSOUT=*
//T1        DD DSN=&&T1,DISP=(,PASS)
//SORTIN    DD DSN=BM7168.OSBT983L.ECOMERCE.SNGLFEED.TO.EDI,DISP=SHR
//SYSIN     DD *
  OPTION COPY
  INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,30000)
  OUTFIL FNAMES=T1,NULLOFL=RC4,
         BUILD=(C'CNT,',37,9,ZD,DIV,+2,M11,LENGTH=9,80:X),CONVERT
//*****************************************************
//STEP02  EXEC PGM=SORT,COND=(4,LE)
//SYSOUT    DD SYSOUT=*
//SYMNAMES  DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN    DD DSN=BM7168.OSBT983L.ECOMERCE.SNGLFEED.TO.EDI,DISP=SHR

....... so on
OK... if i submitted by giving condition i got exact o/p

Instead of PARM='VLTESTI=1' ,NULLOFL=RC4,
is there other thing to give. And you specified 37,9,ZD,GE,30000 why only 37,9 is given??

and in step02 why this BUILD=(1,4,5:14), is used
can you make it clear please...
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 6:22 pm
Reply with quote

Sorry I didn't posted this query in previous one...
1.1st query is, instead of PARM='VLTESTI=1' ,NULLOFL=RC4,
is there other thing to give. and what if not given,and why is given
2.And you specified 37,9,ZD,GE,30000 why only 37,9 is given?? what does it do?
3.and in step02 y this BUILD=(1,4,5:14), is used
4.what does M11 mean and what does it do.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 6:27 pm
Reply with quote

Quote:
OK... if i submitted by giving condition i got exact o/p arun...thanksssssss
You're welcome. But I m not clear what you're doing in step03. Instead I was assuming 2 file sending steps wherein you would execute either of the one based on step01 RC.
Quote:
hi arun,
That was been deleted...by a person as i just asked how to delete..but later asked not to delet as i have queries still on this.

I ws just wondering why would you ask how to delete an entire topic which would have been useful to somebody else later. icon_eek.gif
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 6:43 pm
Reply with quote

hi arun,
As that my requiremnt if any of my team looks over that POST which i did, i don't know what their response would be..so as am new to company i don't know that can i disclose something like that or not..so was just afraid...icon_sad.gif

And am using step03 the one i posted is in wrong way but..actually if step01 file dosent split then step02 shld bypass n step03 should execute in which there is main file that we send to business.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 6:59 pm
Reply with quote

Quote:
actually if step01 file dosent split then step02 shld bypass n step03 should execute in which there is main file that we send to business.
That's fine for step01 returning '4'. But what if step01 gives an RC=0, step02 executes and splits the files? Dont you want to send the splitted files? Do you have an extra step doing this?
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 7:12 pm
Reply with quote

If step01 returning '4'. then step02 dosent execute and will not split the file, so that i should write a step3 with main file i/p file which is used in step01 so that step03 shld execute which is not splitted file this is the one we send to business. SO what condition should be given to step03 to execute after step2 is passsed.

Am i clear for the thing u asked.
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 7:15 pm
Reply with quote

and If step01 returning '0'. then step02 shld execute and shld split the file, for this also i should write another step4 with splitted 2 files which we got in step2,so that ste1,2,4 shld execute by bypassing step3 that shld be sending to business. SO what condition should be given to step2/3/4 to execute and send splitted files in step4
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 7:33 pm
Reply with quote

Quote:
what condition should be given to step03 to execute after step2 is passsed.
Code:
STEP02 ---COND=(4,LE,STEP01)
STEP03 ---COND=(4,NE,STEP01)
STEP04 ---COND=(0,NE,STEP01)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 18, 2008 7:40 pm
Reply with quote

why stick to the unclear COND construct...

every time I have to look at the manual because I never remember ....
if the cond is true is the step executed or not icon_question.gif 12.gif

use the much more clear and understandable // IF
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Nov 18, 2008 7:41 pm
Reply with quote

The folks who maintain what you've written will appreciate your using the IF/THEN/ELSE/ENDIF construct.
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 18, 2008 7:43 pm
Reply with quote

hI ARUN,
Thanks alot for the help till now...i got my o/p.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Nov 18, 2008 7:48 pm
Reply with quote

Quote:
every time I have to look at the manual because I never remember

I thought everybody had good memory like me. icon_lol.gif
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Wed Nov 19, 2008 8:05 am
Reply with quote

hi,

Could you explain me what does the below ones does...

1.1st query is, instead of PARM='VLTESTI=1' ,NULLOFL=RC4,
is there other thing to give like COND parameter and what if not given,and why is given ?

2. in INCLUDE COND=(5,3, y u have taken 5,3 as trailer part starts from 1st column only is it coz of VB?

3.And you specified 37,9,ZD,GE,30000 why only 37,9 is given?Is that for triler count u gave that if so it shld start from 32,9 na?

4.and in step02 y this BUILD=(1,4,5:14), is used and why INCLUDE=(14,3..14 is only used..

Please clear my doubts.

5.what does M11 mean and what does it do.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Nov 19, 2008 2:24 pm
Reply with quote

Quote:
1.1st query is, instead of PARM='VLTESTI=1' ,NULLOFL=RC4,
is there other thing to give like COND parameter and what if not given,and why is given ?
VLTESTI=1 is to handle short records during comparison in INCLUDE processing. NULLOFL='4' causes Syncsort to return '4' if the OUTFIL file is empty.
Quote:
2. in INCLUDE COND=(5,3, y u have taken 5,3 as trailer part starts from 1st column only is it coz of VB?

Yes, first 4 bytes of a VB file is reserved for RDW to store the record length.
Quote:
3.And you specified 37,9,ZD,GE,30000 why only 37,9 is given?Is that for triler count u gave that if so it shld start from 32,9 na?
Your trailer count starts at 37th position.
Quote:
4.and in step02 y this BUILD=(1,4,5:14), is used and why INCLUDE=(14,3..14 is only used..
First sort finds the half of the total record-count(CNT) if it's > 30000. Second sort puts a seq-num for all the records and then selects records with seq-num LE CNT into OUT1 and the rest of the records into OUT2 along with header records. BUILD is used to omit the seq-numbers after INCLUDE processing.
Quote:
5.what does M11 mean and what does it do.
COUNT+nnn produces a result of length=15. M11 is a predefined edit mask to get the count in the required format.

PS. All these are clearly mentioned in the Syncsort Manual. Go through the manual for better understanding. If you don't have one, you can ask Alissa to get you one.
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Dec 02, 2008 12:37 pm
Reply with quote

Hi.
I have opening this query again coz..i need to split the i/p file into 3 o/p files instead of 2 so in step1, the condition will be DIV, +3,but how the count will be taken in step 2 for INCLUDE condition ...can u please explain me, its urgent.. icon_sad.gif icon_sad.gif
//STEP001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(,PASS)
//SORTIN DD DSN=OSB.&ENV..ECOMERCE.SNGLFEED.TO.EDI(0),
// DISP=SHR
//SYSIN DD *
OPTION COPY
INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,300000)
OUTFIL FNAMES=T1,NULLOFL=RC4,
BUILD=(C'CNT,',37,9,ZD,DIV,+3,M11,LENGTH=9,80:X),CONVERT
//*
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Dec 02, 2008 3:53 pm
Reply with quote

snehasai,

I have modified the cards as below. Here you'll have 2 counts-CNT1(one-third of total count) and CNT2(two-third of total count) getting written in first step and which is subsequently used in the succeeding step.

Sort1
Code:
 OPTION COPY                                                     
 INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,00005)           
 OUTFIL FNAMES=T1,NULLOFL=RC4,                                   
 BUILD=(C'CNT1,',37,9,ZD,DIV,+3,M11,LENGTH=9,/,                 
        C'CNT2,',37,9,ZD,MUL,+2,DIV,+3,M11,LENGTH=9,80:X),CONVERT

Sort2
Code:
 OPTION COPY                                                         
 OMIT COND=(5,3,CH,EQ,C'END')                                         
 INREC BUILD=(1,4,SEQNUM,9,ZD,14:5)                                   
 OUTFIL FNAMES=OUT1,REMOVECC,                                         
    INCLUDE=(5,9,ZD,LE,CNT1),BUILD=(1,4,5:14),                       
 TRAILER1=(C'END FEED=ORDER CLIENT=301 LINES=',COUNT+1=(M11,LENGTH=9))
 OUTFIL FNAMES=OUT2,REMOVECC,                                         
    INCLUDE=(14,3,CH,EQ,C'BEG',OR,(5,9,ZD,GT,CNT1,AND,               
                                   5,9,ZD,LE,CNT2)),BUILD=(1,4,5:14),
 TRAILER1=(C'END FEED=ORDER CLIENT=301 LINES=',COUNT+1=(M11,LENGTH=9))
 OUTFIL FNAMES=OUT3,REMOVECC,                                         
    INCLUDE=(14,3,CH,EQ,C'BEG',OR,5,9,ZD,GT,CNT2),BUILD=(1,4,5:14),   
 TRAILER1=(C'END FEED=ORDER CLIENT=301 LINES=',COUNT+1=(M11,LENGTH=9))
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Dec 02, 2008 4:06 pm
Reply with quote

hi arun,
The code dint worked arun, only step1 n step 3 has run...i mean files dint split in step2 and gave maxcc=4
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Dec 02, 2008 4:17 pm
Reply with quote

snehasai,

I m sorry, My test was with around 20 records; hence gave the count in the first sort as 00005. You can change it to 300000 as in your case. Try this and post back if you face any issues.
Code:
 INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,300000)
Back to top
View user's profile Send private message
snehasai

New User


Joined: 14 Nov 2008
Posts: 23
Location: bangalore

PostPosted: Tue Dec 02, 2008 4:19 pm
Reply with quote

hi arun,
I gave 300000 only and submitted not 5

Code:
OPTION COPY
INCLUDE COND=(5,3,CH,EQ,C'END',AND,37,9,ZD,GE,300000)
OUTFIL FNAMES=T1,NULLOFL=RC4,
   BUILD=(C'CNT1,',37,9,ZD,DIV,+3,M11,LENGTH=9,/,
          C'CNT2,',37,9,ZD,MUL,+2,DIV,+3,M11,LENGTH=9,80:X),CONVERT


Edited: Please use BBcode Tags when You post some code, that's rather readable, Thanks...Anuj
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top