Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to find the occurences of a literal.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 135
Location: Coimbatore

PostPosted: Tue Oct 13, 2009 7:04 pm    Post subject: How to find the occurences of a literal.
Reply with quote

I have a file with two records which is like the one mentioned below:

record1: ABDUL00000000000000ABDULMMMMMMMMMMMMMMMABDULJJJJJJJJJJJJJJJ
record2: OOOOOOOOOOABDULIIIIIIIIIIIABDULNNNNABDULQQQQQQQQQQQQQQQ


Kindly give me a jcl to find the occurences of the name "ABDUL" from the two records so that the ouput should be 6. Note that the literal "ABDUL" is placed at different columns in the two records given
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Oct 13, 2009 8:41 pm    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

Hello,

Why is this posted again here?

What about the same request in the IMS part of the forum. . .

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Oct 13, 2009 9:34 pm    Post subject:
Reply with quote

Abdul,

What is the RECFM and LRECL of the input file?

What is the maximum number of times ABDUL can be found in a record?

Is 2 the maximum number of records?

Would the output just be one record with the count? Or would it be the original records with an extra record with the count? Or what? Show the exact expected output for your input example.
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 135
Location: Coimbatore

PostPosted: Fri Oct 16, 2009 3:59 pm    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

The RECFM is FB with LRECL as 80. There can be at the maximum of 100 records. I just want to find the count of "ABDUL" in each record.

This is my requirement.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Oct 16, 2009 9:02 pm    Post subject:
Reply with quote

Again:

Quote:
Would the output just be one record with the count? Or would it be the original records with an extra record with the count? Or what? Show the exact expected output for your input example.
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 135
Location: Coimbatore

PostPosted: Mon Oct 19, 2009 4:01 pm    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

The input should be as the one i have posted:
Input file:
ABDUL00000000000000ABDULMMMMMMMMMMMMMMMABDULJJJJJJJJJJJJJJJ
OOOOOOOOOOABDULIIIIIIIIIIIABDULNNNNABDULQQQQQQQQQQQQQQQ

Output file:
Count of "ABDUL" is : 6

This is how my output file has to look. Please give me a JCL to find it out
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Oct 19, 2009 9:37 pm    Post subject:
Reply with quote

You can use a DSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/30)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=5,
    IFTHEN=(WHEN=INIT,PARSE=(%01=(STARTAT=C'ABDUL',FIXLEN=5),
            %02=(STARTAT=C'ABDUL',FIXLEN=5),
            %03=(STARTAT=C'ABDUL',FIXLEN=5),
            %04=(STARTAT=C'ABDUL',FIXLEN=5),
            %05=(STARTAT=C'ABDUL',FIXLEN=5),
            %06=(STARTAT=C'ABDUL',FIXLEN=5),
            %07=(STARTAT=C'ABDUL',FIXLEN=5),
            %08=(STARTAT=C'ABDUL',FIXLEN=5),
            %09=(STARTAT=C'ABDUL',FIXLEN=5),
            %10=(STARTAT=C'ABDUL',FIXLEN=5),
            %11=(STARTAT=C'ABDUL',FIXLEN=5),
            %12=(STARTAT=C'ABDUL',FIXLEN=5),
            %13=(STARTAT=C'ABDUL',FIXLEN=5),
            %14=(STARTAT=C'ABDUL',FIXLEN=5),
            %15=(STARTAT=C'ABDUL',FIXLEN=5),
            %16=(STARTAT=C'ABDUL',FIXLEN=5)),
         BUILD=(%01,%02,%03,%04,%05,%06,%07,%08,
                %09,%10,%11,%12,%13,%14,%15,%16)),
    IFTHEN=(WHEN=INIT,FINDREP=(IN=C'ABDUL',OUT=C'00001')),
    IFTHEN=(WHEN=INIT,
      BUILD=(1,5,UFF,ADD,6,5,UFF,ADD,11,5,UFF,ADD,16,5,UFF,ADD,
             21,5,UFF,ADD,26,5,UFF,ADD,31,5,UFF,ADD,36,5,UFF,ADD,
             41,5,UFF,ADD,46,5,UFF,ADD,51,5,UFF,ADD,56,5,UFF,ADD,
             61,5,UFF,ADD,66,5,UFF,ADD,71,5,UFF,ADD,76,5,UFF,
             TO=ZD,LENGTH=5))
  OUTFIL REMOVECC,NODETAIL,
    BUILD=(30X),
    TRAILER1=('COUNT OF ''ABDUL'' IS: ',TOT=(1,5,ZD,M10,LENGTH=5))
/*
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 135
Location: Coimbatore

PostPosted: Tue Oct 27, 2009 10:28 am    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

Hi,

Thanks for your help. The code is working fine.

Is there a more optimistic way to perform my operation or is this the only way we can?.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Oct 27, 2009 7:54 pm    Post subject:
Reply with quote

Hello,

"optimistic" - possibly optimal?

What in the provided code do you want to change?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Oct 27, 2009 8:00 pm    Post subject:
Reply with quote

If you take to mind that Frank is the guy that develops and maintains DFSORT / ICETOOL within IBM and he gives a solution to a problem, then his way will most certainly be the most optimal / optimistic / opthalmic solution.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Oct 27, 2009 9:34 pm    Post subject:
Reply with quote

Quote:
Is there a more optimistic way to perform my operation or is this the only way we can?


Well, you could certainly write your own program or exit to do it. Whether that would be more optimistic (sic) is for you to determine.
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 135
Location: Coimbatore

PostPosted: Wed Oct 28, 2009 9:52 am    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

Ok frank. I have executed only your code. Thanks a lot.
Back to top
View user's profile Send private message
Shaheen Kalokhe

New User


Joined: 21 Feb 2008
Posts: 21
Location: India

PostPosted: Wed Oct 28, 2009 8:06 pm    Post subject:
Reply with quote

Frank what eaxctly will the following statements do

IFTHEN=(WHEN=INIT,PARSE=(%01=(STARTAT=C'ABDUL',FIXLEN=5),
%02=(STARTAT=C'ABDUL',FIXLEN=5),
%03=(STARTAT=C'ABDUL',FIXLEN=5),
%04=(STARTAT=C'ABDUL',FIXLEN=5),
%05=(STARTAT=C'ABDUL',FIXLEN=5),
%06=(STARTAT=C'ABDUL',FIXLEN=5),
%07=(STARTAT=C'ABDUL',FIXLEN=5),
%08=(STARTAT=C'ABDUL',FIXLEN=5),
%09=(STARTAT=C'ABDUL',FIXLEN=5),
%10=(STARTAT=C'ABDUL',FIXLEN=5),
%11=(STARTAT=C'ABDUL',FIXLEN=5),
%12=(STARTAT=C'ABDUL',FIXLEN=5),
%13=(STARTAT=C'ABDUL',FIXLEN=5),
%14=(STARTAT=C'ABDUL',FIXLEN=5),
%15=(STARTAT=C'ABDUL',FIXLEN=5),
%16=(STARTAT=C'ABDUL',FIXLEN=5)),

What is the use of %01,%02....%16.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 28, 2009 9:34 pm    Post subject:
Reply with quote

For an Overview of DFSORT's PARSE function, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG40/2.5?DT=20090519162426

DFSORT's PARSE function is explained in detail in my paper available at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000086
Back to top
View user's profile Send private message
Shaheen Kalokhe

New User


Joined: 21 Feb 2008
Posts: 21
Location: India

PostPosted: Fri Oct 30, 2009 7:55 pm    Post subject: Reply to: How to find the occurences of a literal.
Reply with quote

Thank you Frank for your reply. I will definetly have a look at the links given by you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm
No new posts How to find jobs that are in schedule... anilkumar922 All Other Mainframe Topics 5 Tue Jun 28, 2016 10:01 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us