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

counting the non-blank characters


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

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Tue May 29, 2007 7:19 pm
Reply with quote

May I know how to count the number of non-blank characters in a particular column of file....

Means Let us suppose we have blanks and non-blanks in column 10...then how to count all non-blank characters in column 10 using F ALL command or any command is there...

1. it should count only alphabets.
2. it should count only numerics.

Regards,
pavan
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 29, 2007 7:25 pm
Reply with quote

Intrigued, why would you want to do this ???
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue May 29, 2007 8:32 pm
Reply with quote

try this code
Code:
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
111111111 111111.....11111                                             
2222222222222222.....22222                                             
333333333 333333.....33333                                             
4444444444444444.....44444                                             
/*                                                                     
//NUM       DD SYSOUT=*                                                 
//NONNUM   DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(NUM) USING(CP01)                                   
 COPY FROM(IN1)  TO(NONNUM) USING(CP02)                                 
/*                                                                     
//CP01CNTL DD   *                                                       
  INCLUDE COND=(10,1,CH,EQ,NUM,AND,10,1,CH,NE,' ')                     
  OUTFIL NODETAIL,REMOVECC,                                             
  TRAILER1=(COUNT=(M11,LENGTH=8))                                       
/*                                                                     
//CP02CNTL DD   *                                                       
  INCLUDE COND=(10,1,CH,NE,NUM,AND,10,1,CH,NE,' ')                     
  OUTFIL NODETAIL,REMOVECC,                                             
  TRAILER1=(COUNT=(M11,LENGTH=8))                                       
/*                                                                     
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 May 29, 2007 9:33 pm
Reply with quote

pavan,

Here's a DFSORT job that will do what I think you asked for:

Code:

//S1       EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
        <A>
        < >
        <2>
        < >
        <4>
        <B>
        <C>
/*
//NUM      DD SYSOUT=*
//ALPHA    DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INCLUDE COND=(10,1,CH,NE,C' ')
  OUTFIL FNAMES=NUM,NODETAIL,REMOVECC,
    INCLUDE=(10,1,FS,EQ,NUM),
    TRAILER1=(COUNT=(M11,LENGTH=8))
  OUTFIL FNAMES=ALPHA,NODETAIL,REMOVECC,
    SAVE,
    TRAILER1=(COUNT=(M11,LENGTH=8))
/*


NUM would have:

00000002

and ALPHA would have:

00000003

You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's NUM function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links

If you can't use NUM, you could use this instead:

Code:

    INCLUDE=(10,1,SS,EQ,C'0123456789'),
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 May 29, 2007 9:33 pm
Reply with quote

krisprems,

Why would you think you need to do this in two passes?

And if you had tested your "solution" you would have realized that 10,1,CH,EQ,NUM is invalid.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue May 29, 2007 11:55 pm
Reply with quote

You can use the picture option of the find command, if you use ISPF editor:
P'='
Any character
P'?'
Any character that is not a blank
P'.'
Any character that cannot be displayed
P'#'
Any numeric character, 0-9
P'-'
Any non-numeric character
P'@'
Any alphabetic character, uppercase or lowercase
P'<'
Any lowercase alphabetic character
P'>'
Any uppercase alphabetic character
P'$'
Any special character, neither alphabetic nor numeric.

For example, if you want to count the number of rows containing numeric characters at column 10, you should use the following command: FIND ALL P'#' 10 10. The number of matched rows will be displayed as a short message (usually at the upper right corner of the screen).

O.
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

 


Similar Topics
Topic Forum Replies
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts Count the number of characters in a f... CA Products 1
No new posts File transfer from host with filler f... TSO/ISPF 15
Search our Forums:

Back to Top