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

Remove blank record in a file using sort Utility


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

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 3:43 pm
Reply with quote

Hi,

Could anyone suggest how to remove blank records in a file using sort
utility or anyother way.

Thanks'
Madhu
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Aug 21, 2007 3:46 pm
Reply with quote

Madhu,

Quote:
Could anyone suggest how to remove blank records in a file using sort
utility or anyother way.


Use INCLUDE/OMIT option in SORT utility.
Back to top
View user's profile Send private message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 3:52 pm
Reply with quote

I have one file , there are records some records are blank, i want to eliminate , Could you suggest me the solution with Syntax.

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Aug 21, 2007 3:53 pm
Reply with quote

Madhu Reddy
If your file is 80 byte long, then this is the solution, if not, change the 80 in include statement to the LRECL of the file.
Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT= *                                 
//SORTIN   DD DSN=I/P FILE NAME                         
//SORTOUT  DD DSN=O/P FILE NAME                         
//SYSIN    DD *                                         
           SORT FIELDS=COPY                             
           OMIT COND=(1,80,CH,EQ,C' ')                   
/*                                                       


If still unresolved,then provide i/p and o/p file format and lrecl?
Back to top
View user's profile Send private message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 4:07 pm
Reply with quote

I have one file , i am copying particular column to another file, in some column there may be blanks, now i want to elimate the blank rows in the
copied file, i tried with Omit , It is not working.

Can you suggest me.

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Aug 21, 2007 4:36 pm
Reply with quote

Madhu Reddy
Read my quote
Quote:
If still unresolved,then provide i/p and o/p file format and lrecl?



Quote:
i tried with Omit , It is not working.

Show the SORT JCL that you gave a try!

Quote:
in some column there may be blanks, now i want to elimate the blank rows in the
copied file,

Give the layout of the columns that you are copying, and which all columns that you are verifying for blank's?
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Aug 21, 2007 4:42 pm
Reply with quote

Hi Madhu,
Quote:
now i want to elimate the blank rows in the


What do you exactly mean by blank rows here ?
A row with "your column" blank OR
A row with all the bytes blank ??

If it is first case, krisprems has already given solution. Use your file LRECL in OMIT condition insted of 80.

If it is second case, then use
Code:

OMIT COND=(column_starting_position,length_of_column,CH,EQ,C' ')                   
/*                                           


--Parag
Back to top
View user's profile Send private message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 4:52 pm
Reply with quote

The below is the JCL which i am using


000300 //SORT1 EXEC PGM=ICEMAN
000400 //SYSOUT DD SYSOUT=*
000410 //DFSMSG DD SYSOUT=*
000510 //STATOUT DD SYSOUT=*
000600 //SORTIN DD DSN=NBK5ZIO.AM32R2(Input file ).SOUTP,DISP=SHR
000610 //SORTOUT DD DSN=NBKEZ7A.NONDUP.DATA33X,
000620 // UNIT=SYSALLDA,SPACE=(CYL,(3,10)),
000630 // DISP=(NEW,CATLG,DELETE),
000640 // DCB=(LRECL=10,BLKSIZE=27900,RECFM=FB)
000800 //SYSIN DD *
000900 SORT FIELDS=(321,8,CH,A),EQUALS
000910 SUM FIELDS=NONE
001000 OUTREC FIELDS=(1:321,8)
001010 OMIT COND=(1,10,CH,EQ,C' ')
001100 //

In the above JCL i am sorting and copying a particular Column to another file , there in the copied file i am getting some blank lines , i dont want that blank lines also , this was my requirement

InPut dataset details

General Data Current Allocation
Management class . . : DEV Allocated cylinders : 3
Storage class . . . : DEV1000 Allocated extents . : 1
Volume serial . . . : 9SDS3D
Device type . . . . : 3390
Data class . . . . . : ADDDSORG Current Utilization
Organization . . . : PS Used cylinders . . : 3
Record format . . . : FB Used extents . . . : 1
Record length . . . : 450
Block size . . . . : 27900
1st extent cylinders: 3
Secondary cylinders : 10
Data set name type : SMS Compressible : NO
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 21, 2007 5:23 pm
Reply with quote

I think you want only the contents from position 321 and length 8 in output by sorting in ascending order with no duplicates. The following sort card will help you for this.
Code:
//SYSIN DD *
 OMIT COND=(321,8,CH,NE,C' ')
 INREC FIELDS=(321,8)
 SORT FIELDS=(321,8,CH,A)
 SUM FIELDS=NONE
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 21, 2007 5:25 pm
Reply with quote

SORT FIELDS=(321,8,CH,A) is wrong in the previous one.
Sorry use the below one

Code:
//SYSIN DD *
 OMIT COND=(321,8,CH,NE,C' ')
 INREC FIELDS=(321,8)
 SORT FIELDS=(1,8,CH,A)
 SUM FIELDS=NONE
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 21, 2007 5:29 pm
Reply with quote

again sorry
OMIT COND=(321,8,CH,NE,C' ') is also wrong in the previous posts.
try the below one
Code:
//SYSIN DD *
 OMIT COND=(321,8,CH,EQ,C' ')
 INREC FIELDS=(321,8)
 SORT FIELDS=(1,8,CH,A)
 SUM FIELDS=NONE
Back to top
View user's profile Send private message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 7:51 pm
Reply with quote

Hi,

In my Output file previously when i run i use to get 2 blank lines, but
now even after running the program using the code which you have send
still i am getting one blank line.

Please suggest me the solutions.

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Aug 21, 2007 8:23 pm
Reply with quote

Madhu Reddy
Do you want to check for blank fields from 321 to 8 bytes or from 1 to 10 bytes of the i/p file?
shankar.v's JCL is checking for blanks from 321 to 328,
and the JCL that you have shown its checking blanks from 1 to 10

If needed you can check for blank's in both the positions that is 321,8 and 1,10, as shown below
Code:
//SYSIN DD *
 SORT FIELDS=(321,8,CH,A),EQUALS
 SUM FIELDS=NONE
 OUTREC FIELDS=(1:321,8)
 OMIT COND=(1,10,CH,EQ,C' ',|,321,8,CH,EQ,C' ')
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: Tue Aug 21, 2007 9:53 pm
Reply with quote

Quote:
In my Output file previously when i run i use to get 2 blank lines, but
now even after running the program using the code which you have send
still i am getting one blank line.

Please suggest me the solutions.


It's very difficult to give you a solution because you haven't really described what you're trying to do, what your input records look like, etc.
But as a guess, try these DFSORT control statements to eliminate your blank lines:

Code:

  SORT FIELDS=(321,8,CH,A),EQUALS
  SUM FIELDS=NONE
  OUTREC FIELDS=(1:321,8)
  OUTFIL OMIT=(1,8,CH,EQ,C' ')


The OUTFIL OMIT will remove any output lines with blanks in positions 1-8 that remain after SORT and SUM.

It would be more efficient to remove the blank lines before sorting and I would think that the following control statements suggested by Krisprems would do that:

Code:

  OMIT COND=(321,8,CH,EQ,C' ')
  INREC FIELDS=(321,8)
  SORT FIELDS=(1,8,CH,A)
  SUM FIELDS=NONE


But you say you still have one blank line with those control statements - I don't see how unless you mean something by "blank line" that makes no sense.

It would really help if you would answer the questions people ask, show your input and output, etc. In other words, give the information people need to provide a solution rather than making them guess at what you want.
Back to top
View user's profile Send private message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Wed Aug 22, 2007 2:18 pm
Reply with quote

I have one file with many rows and columns, i want to copy one particular

column to another file, sort and eliminate duplicates, Up to this my program is working fine, but in the output file, the first row is blank
i should not get this.
the output looks like this

***********
.......
PACEADM
PACEINQ
PACEINV
PACETAX
PCCTRAP
UNTAADM

There should be no Blank line or low values.

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Aug 22, 2007 3:08 pm
Reply with quote

Madhu Reddy
Note that LOW-VALUE and BLANKS(space's) are different.
You can use this OMIT statement to exclude the records with LOW-VALUEs
Code:

  OMIT COND=(column_starting_position,length_of_the_column,BI,EQ,X'00')
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: Wed Aug 22, 2007 8:24 pm
Reply with quote

Madhu,

Quote:
There should be no Blank line or low values.


Why did it take you 6 posts before you mentioned low values? Please try to give complete information in your FIRST post in the future.

If you want to remove records with all blanks or low values in a particular field, you can use a DFSORT statement like this:

Code:

    OMIT COND=(p,m,CH,EQ,C' ',OR,p,m,BI,EQ,X'00')


where p,m is the starting position and length of the field you want to check.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top