MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort Input file based on certain criteria !!
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Feb 24, 2006 11:13 am    Post subject: Reply with quote

VLSCMP won't help. VLSCMP only has an effect for short INCLUDE/OMIT fields. In this case, the short field is an INREC field (63,1), so using VLFILL on OUTFIL has no effect given that OUTFIL is processed after INREC. You could get around this by using OVERLAY or IFTHEN, but since you don't have the Dec, 2004 DFSORT PTF, you can't use those. You could use OUTFIL with VLFILL in one pass to pad out the records and then operate against those padded records in a second pass, but you would end up with padded records. If that's a problem, you could use VLFILL in the first pass with a unique padding character and VLTRIM in the second pass to remove that unique padding character.
_________________
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
View user's profile Send private message Send e-mail Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 107
Topics: 35
Location: Singapore

PostPosted: Fri Feb 24, 2006 11:49 pm    Post subject: Reply with quote

Hi Kolusu, thanks a lot for the solution you have provided me to omit records and process the useful records. It has worked for me. Thanks again.

Hi Frank thanks a lot for the suggestion. I got the approach you are giving here, but when I used VLFILL with OUTFIL also I am getting the same error. I have given the SORT card I had used in my post above:

//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(1,5,6:63,1,CHANGE=(1,C'*',C'1'),NOMATCH=(C'0'),
SEQNUM,8,ZD,6)
OUTFIL OUTREC=(1,5,
6,1,ZD,ADD,7,8,ZD,EDIT=(TTTTTTTT),15),VLFILL=C'X'
/*

If there is some error kindly let me know how should I use the SORT approach you have given. If you can provide me with the sample SORT cards I would be really grateful to you.

Thanks,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Feb 25, 2006 11:26 am    Post subject: Reply with quote

Amit,

Please read what I said carefully:
Quote:
You could use OUTFIL with VLFILL in one pass to pad out the records and then operate against those padded records in a second pass, but you would end up with padded records. If that's a problem, you could use VLFILL in the first pass with a unique padding character and VLTRIM in the second pass to remove that unique padding character.


I didn't say you could use one pass with just VLFILL which is what you're trying to do. If you want me to show you how to do what I suggested, let me know whether or not you're ok with having your output records padded with blanks (or some other character) to a fixed length. If you need the output records to be variable length, then tell me a character I can use that will NOT be found in your input file (e.g. X'FF').

Also, what is the LRECL of the input file?
_________________
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
View user's profile Send private message Send e-mail Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 107
Topics: 35
Location: Singapore

PostPosted: Sat Feb 25, 2006 11:21 pm    Post subject: Reply with quote

Hi Frank...thanks a lot first of all for reading my query and replying on a weekend Smile
Actually, my input data set is a VBA 137 and the output data set also I am intending to be a VBA 137, as I would not like to consume unnecessary space on DASD.
Kindly let me know how I can use Kolusu's suggestion for my input data set and get an ouput VBA 137 data set with no unwanted characters padded. I mean the output data set will be same as input dataset with only the expected records.

Yes as per your question of what character you can use I presume 'XX' is OK as X'FF' is less desirable.

Thanks a lot again.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sun Feb 26, 2006 11:18 am    Post subject: Reply with quote

Ok. Here's the control statements you're starting with that don't work because of the short records:

Code:

//SYSIN DD *
  SORT FIELDS=COPY
  INREC FIELDS=(1,5,6:63,1,CHANGE=(1,C'*',C'1'),NOMATCH=(C'0'),
    SEQNUM,8,ZD,6)
  OUTREC FIELDS=(1,5,
    6,1,ZD,ADD,7,8,ZD,EDIT=(TTTTTTTT),15)
/*


And here's a DFSORT/ICETOOL job using VLFILL and VLTRIM that will take care of the short record problem:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) USING(CTL2)
//CTL1CNTL DD *
  OPTION COPY
  OUTFIL FNAMES=T1,OUTREC=(1,63,64),VLFILL=X'FF'
/*
//CTL2CNTL DD *
  SORT FIELDS=COPY
  INREC FIELDS=(1,5,6:63,1,CHANGE=(1,C'*',C'1'),NOMATCH=(C'0'),
    SEQNUM,8,ZD,6)
  OUTFIL FNAMES=OUT,OUTREC=(1,5,
    6,1,ZD,ADD,7,8,ZD,EDIT=(TTTTTTTT),15),VLTRIM=X'FF'
/*


Quote:
as per your question of what character you can use I presume 'XX' is OK as X'FF' is less desirable


You can only use one character for VLFILL and VLTRIM, so C'X' or X'FF' would be ok as long as that character doesn't appear in your input records, but C'XX' isn't ok because it's two characters. I used X'FF' in my example, but you can change that to any one character that works for your data.
_________________
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
View user's profile Send private message Send e-mail Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 107
Topics: 35
Location: Singapore

PostPosted: Tue Mar 07, 2006 5:53 am    Post subject: Reply with quote

Hi Frank/Kolusu,

My team lead has now asked me to copy certain records from my SYSLOG which is a VBA 137 data set to a FBA 137 data set for all records which have '*' at position 58(63 in this case as my input is VBA), and when I searched SORT manual I think we can use VTOF function which will internally use VLFILL to fill FBA output file with blanks. I am using the below SORT card in ICETOOL which is giving me error:
ICE000I 0 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 18:29 ON TUE MAR
SORT FIELDS=COPY
INCLUDE COND=(63,1,CH,EQ,'*')
$
ICE113A E COMPARISON FIELD ERROR

The SORT card I used is as below :

//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(63,1,CH,EQ,'*')
OUTFIL FNAMES=OUT,OUTREC=(1,63),VTOF
/*

I know I am eating up your heads, but kindly advise as to how can I achieve my result without using any temporary data set for processing as SYSLOGs are quite huge data sets.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Tue Mar 07, 2006 6:56 am    Post subject: Reply with quote

Amit,
To include the records having '*' at position 58 of VBA 137 dataset to 137 FBA file, Use the following SYSIN cards

Code:
//SYSIN        DD  * *** CONSTANT CONTROL CARDS ***     
  OPTION COPY,VLSHRT                                     
  INCLUDE COND=(62,1,CH,EQ,X'5C')                       
  OUTFIL FNAMES=OUT,VTOF,OUTREC=(4,133,4X)               
/*    END OF INPUT                                       


Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Tue Mar 07, 2006 7:06 am    Post subject: Reply with quote

Code:
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(63,1,CH,EQ,'*')
OUTFIL FNAMES=OUT,OUTREC=(1,63),VTOF
/*


There is a syntax error in Include condition ICE113A E COMPARISON FIELD ERROR .It should be
Code:
INCLUDE COND=(63,1,CH,EQ,C'*')


Also Outrec cannot reference RDW bytes of VBA and hence need to be changed to OUTREC=(5,63)

Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Tue Mar 07, 2006 7:11 am    Post subject: Reply with quote

Code:
Also Outrec cannot reference RDW bytes of VBA and hence need to be changed to OUTREC=(5,63)


I mean you will get incorrect results, if you refer the RDW bytes.

Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 107
Topics: 35
Location: Singapore

PostPosted: Wed Mar 08, 2006 9:54 pm    Post subject: Reply with quote

Hi Jaya,

Thanks a lot for the help. The JCL now works fine except that in the SORT card you had provided had to make minor modification like "INCLUDE COND=(63,1,CH,EQ,X'5C')" and "OUTREC=(5,133,4X)".

Would just like to ask if I have to write the data to a VBA 137 output data set what changes do I need to make in the SORT card provided that I do not want records to be padded with blanks in my VBA output data set, as VTOF pads data with blanks internally using VLFILL X'40'??

Kindly reply.

Thanks,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Thu Mar 09, 2006 12:21 am    Post subject: Reply with quote

Amit,

For copying VBA 137 dataset to another VBA 137 file,

Code:
//TEMP05   EXEC PGM=SORT,                                     
//            COND=(0,NE)                                     
//*                                                           
//SORTIN       DD  DSN=JAYA.SYSOUT.TEST,DISP=SHR           
//*                                                       
//SORTOUT      DD  DSN=JAYA.SYSOUT.TEST.VBA,               
//            DISP=(NEW,CATLG,DELETE),                     
//            UNIT=SYSDA,                                 
//            SPACE=(TRK,(250,50),RLSE),                   
//            DCB=(RECFM=VBA,BLKSIZE=0)                   
//*    ****  SORTED JE FILE   ****                         
//*                                                       
//SYSPRINT     DD  SYSOUT=*                               
//SYSOUT       DD  SYSOUT=*                               
//ABENDAID     DD  SYSOUT=*                               
//SYSUDUMP     DD  SYSOUT=*                               
//*                                                       
//SYSIN        DD  * *** CONSTANT CONTROL CARDS ***       
  OPTION COPY,VLSHRT                                       
  INCLUDE COND=(62,1,CH,EQ,X'5C')                         
/*    END OF INPUT             


Quote:
OUTFIL data sets used for reports must have or will be given ANSI control character format ('A' as in, for example, RECFM=FBA or RECFM=VBA), and must allow an extra byte in the LRECL for the carriage control character that DFSORT will add to each report and data record. DFSORT uses these carriage control characters to control page ejects and the placement of the lines in your report according to your specifications. DFSORT uses appropriate carriage controls (for example, C'-' for triple space) in header and trailer records when possible, to reduce the number of report records written. DFSORT always uses the single space carriage control (C' ') in data records. Although these carriage control characters may not be shown when you view an OUTFIL data set (depending upon how you view it), they will be used if you print the report.


REMOVECC can be used to remove the ANSI control characters from a report. In this case, an 'A' is not added to or required for the RECFM and an extra byte is not added to or required for the LRECL.


We need to keep in mind the above infomation from FINE MANUAL while working on FBA or VBA, so that we need have confusion on input column positions.

Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 09, 2006 11:52 am    Post subject: Reply with quote

Amit,

You keep changing your mind about what you want: VBA to VBA, VBA to FBA, VBA to VBA. Nobody can help you until you know exactly what it is you want to do and describe it clearly. At this point, I have no idea any more of what you're actually trying to do.
_________________
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
View user's profile Send private message Send e-mail Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 107
Topics: 35
Location: Singapore

PostPosted: Thu Mar 09, 2006 8:48 pm    Post subject: Reply with quote

Hey Frank, sorry for confusing you folks. I really really apologize for that, but I am not a person who has worked more on SORT and so had to ask queries as per the change in requirements in the project, and so I really am sorry if at all my queries have caused any inconvenience to you people.

Jaya thanks a lot for the suggestion, it has worked and now I have the job already scheduled in production.

I thank all of you for spending efforts on this forum and helping people like us.

Its my fault, I could have asked you directly to give me a SORT jcl to copy VBA 137 file based on certain conditions to a VBA 137 file.

Thanks,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group