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

Compare the length of a data


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

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Jan 27, 2011 2:35 pm
Reply with quote

I have following record :
Code:

100 RECORD1
200 RECD2
300 RECORD3
400 RECD4
500 RECORD5


here, 100 is field-1(starting at position 1 and length is 3) and RECORD1 is fieled-2(starting at position 5 and length is 10)
All I want to do is to select only those records whose second fields data length is greater than 5.

in my example , i am intrested in records :
Code:

100 RECORD1
300 RECORD3
500 RECORD5


How do I write the DFSORT control statement to get this done ?

Any help is highly appreciated.

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 27, 2011 2:39 pm
Reply with quote

Hello,

One way to do what you want is to INCLUDE only records that are non-blank in the last 5 positions (or OMIT those that are blank).
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Jan 27, 2011 2:42 pm
Reply with quote

@dick


Thanks for the quick response.
Is there any length function that could serve the purpose.
I have researched on this but couldnt find any results.

Thanks a lot.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 27, 2011 2:46 pm
Reply with quote

Hello,

Specify the length (which for your question is 5) in the include or omit statement. . . It is part of the required syntax.
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: Fri Jan 28, 2011 12:21 am
Reply with quote

There is no "find the length of the characters up to the first blank" function.

But there are other ways to do what you want.
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Jan 28, 2011 9:50 am
Reply with quote

Hi Frank,

Could you please tell me what are the other ways to do this.

Thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 28, 2011 10:23 am
Reply with quote

Hello,

If the posted "requirement" and the suggested solution do not do what you want, you need to post the "real" requirement (i.e. What are you really trying to accomplish?).

Suggest you post some "real" sample input and the output you want from that sample input. Post the rules for getting from the input to the output. Mention the recfm and lrecl of the files.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Fri Jan 28, 2011 1:24 pm
Reply with quote

Quote:
100 is field-1(starting at position 1 and length is 3) and RECORD1 is fieled-2(starting at position 5 and length is 10)
All I want to do is to select only those records whose second fields data length is greater than 5.


By your definition, all the second fields have a length of 10. They may be padded with blanks or nulls, but they still have a length of 10.

Any chance you might be dealing with a VB rather than FB file?

Garry.
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: Sat Jan 29, 2011 1:01 am
Reply with quote

Quote:
Could you please tell me what are the other ways to do this.


Assuming your input has RECFM=FB and you want to keep the records that have a non-blank in positions 1-6 (> 5 non-blank characters), you can use these DFSORT control statements:

Code:

   OPTION COPY
   OMIT COND=(5,6,SS,EQ,C' ') 


So if your input records were:

Code:

100 RECORD1           
200 RECD2             
300 RECORD3           
400 RECD4             
500 RECORD5           
601 A                 
602 AB                 
603 ABC               
604 ABCD               
605 ABCDE             
606 ABCDEF             
607 ABCDEFG           
608 ABCDEFGH           
609 ABCDEFGHI         
610 ABCDEFGHIJ         


Your output records would be:

Code:

100 RECORD1         
300 RECORD3         
500 RECORD5         
606 ABCDEF           
607 ABCDEFG         
608 ABCDEFGH         
609 ABCDEFGHI       
610 ABCDEFGHIJ       


If that's NOT what you want, then you need to do a better job of explaining what you do want with better examples of input and expected output.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 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 Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top