View previous topic :: View next topic
|
Author |
Message |
sandra
New User
Joined: 06 Apr 2005 Posts: 27
|
|
|
|
I have a file in which there are thousands of records and some of the records are spaces. How can I put in the condition to remove blank records in the file? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
sandra
Is there any mandatory(key) field in your file, that which cannot be blank?
If so, use a sort card to add an omit cond to check if the filed is blank.
Also what is lrecl and RECFM of the file? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If i understand the question, there are records that are entirely blank. Even if the blanks are only in particular positions, those can be bypassed also.
No sort key should be needed to OMIT those, just the place(s) where the blanks are not wanted.
Also, if you specify COPY rather than SORT you will preserve the current sequence and have a new file with the blank records removed and it will run faster than sorting.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sandra,
What is the RECFM and LRECL of your input file? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Sandra,
You're welcome
As Frank asks
Quote: |
What is the RECFM and LRECL of your input file?
|
|
|
Back to top |
|
|
sandra
New User
Joined: 06 Apr 2005 Posts: 27
|
|
|
|
What is the RECFM and LRECL of your input file?
recfm=FB and LRECL=120 |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi,
Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=Input File,DISP=SHR
//SORTOUT DD DSN=Output File,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(5,5),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(1,120,CH,EQ,C' ')
/*
|
--Parag |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Notice that you only need one blank in the constant - C' '. DFSORT pads a character constant with blanks on the right to match the length of the field, so in this case it pads the constant from 1 blank to 120 blanks. Saves a lot of typing. |
|
Back to top |
|
|
|