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 Profile Log in to check your private messages Log in
 
comparing fields with occurs clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mercy
Warnings : 1

New User


Joined: 25 Jun 2006
Posts: 10
Location: Bangalore

PostPosted: Wed Aug 30, 2006 6:25 pm    Post subject: comparing fields with occurs clause
Reply with quote

Hi,
Can anybody help me out of this???
The below declarations are from the copy book CLM_DATA.
The same copy book is used for both input and output files so I used

HS-SVC-CD OF CLM_DATA as i need to filter the records from the input.





10 HIDDEN-RMC PIC X(2).
10 RPT-LN-ITEM-CNT PIC S9(3) COMP-3.
05 LINE-DATA-OCCURS OCCURS 1 TO 65 TIMES
DEPENDING ON RPT-LN-ITEM-CNT
INDEXED BY LN-INDX.

10 HS-SVC-CD PIC X(3).

10 RPT-HML-PRCG-SVC-CD PIC X(03).



HOW CAN I CHECK THE CONDITIONS THAT ARE BELOW.



IF ((HS-SVC-CD OF CLM_DATA = 'PHO' OR 'PRV') AND
(HS-PROC-SVC-CLS-CD OF CLM-DATA = '01C'
OR '07B' OR '07C'
OR '07D' OR '01I' OR '07F' OR '07I' OR '07K'
OR '07L' OR '07M' OR '07T'))
WS-WRITE = 'T'
END-IF

can anybody specify the code for this?

Thanq Very Much in advance.


Mercy.
Back to top
View user's profile Send private message

vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Aug 30, 2006 7:00 pm    Post subject:
Reply with quote

Please explain cleary your requirement
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

PostPosted: Wed Aug 30, 2006 10:41 pm    Post subject:
Reply with quote

you can use COPY as

COPY TEXTNAME IN LIBNAME

This will replace the copy with content of text file and all in text file will be inseted in to the source code all rules for programming are applicable to content of text file
Back to top
View user's profile Send private message
mercy
Warnings : 1

New User


Joined: 25 Jun 2006
Posts: 10
Location: Bangalore

PostPosted: Thu Aug 31, 2006 9:33 am    Post subject: Re: comparing fields with occurs clause
Reply with quote

10 HIDDEN-RMC PIC X(2).
10 RPT-LN-ITEM-CNT PIC S9(3) COMP-3.
05 LINE-DATA-OCCURS OCCURS 1 TO 65 TIMES
DEPENDING ON RPT-LN-ITEM-CNT
INDEXED BY LN-INDX.

10 HS-SVC-CD PIC X(3).
10 RPT-HML-PRCG-SVC-CD PIC X(03).



HOW CAN I CHECK THE CONDITIONS THAT ARE BELOW.

IF ((HS-SVC-CD OF CLM_DATA = 'PHO' OR 'PRV') AND
(HS-PROC-SVC-CLS-CD OF CLM-DATA = '01C'
OR '07B' OR '07C'
OR '07D' OR '01I' OR '07F' OR '07I' OR '07K'
OR '07L' OR '07M' OR '07T'))
WS-WRITE = 'T'
END-IF



In the above if stmt HS-SVC-CD is a field which is present inside OCCURS clause.So for every value of HS-SVC-CD I need to check the condition.Similarly for every value of HS-PROC-SVC-CLS-CD.So how can i do this.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Thu Aug 31, 2006 2:21 pm    Post subject:
Reply with quote

From the example, I see that there is no level 01 in the COPY itself.
You can declare:
Code:
01  CLM-DATA-INP.
    COPY CLM_DATA.
01  CLM-DATA-OUT.
    COPY CML_DATA.
Then you can use HS-SVC-CD OF CLM-DATA-INP and HS-SVC-CD OF CLM-DATA-OUT

On the other hand, if you had a level 01 inside the COPY, you could declare:
Code:
    COPY CLM_DATA REPLACING ==Level01Name== BY ==NewName1==.
    COPY CLM_DATA REPLACING ==Level01Name== BY ==NewName2==.
Then you could use HS-SVC-CD OF NewName1 and HS-SVC-CD OF NewName2
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Thu Aug 31, 2006 2:29 pm    Post subject:
Reply with quote

Quote:
10 HIDDEN-RMC PIC X(2).
10 RPT-LN-ITEM-CNT PIC S9(3) COMP-3.
05 LINE-DATA-OCCURS OCCURS 1 TO 65 TIMES
DEPENDING ON RPT-LN-ITEM-CNT
INDEXED BY LN-INDX.

10 HS-SVC-CD PIC X(3).
10 RPT-HML-PRCG-SVC-CD PIC X(03).


By the way, mixing levels as you do in the CLM_DATA is not healthy.
It works (I think it works) only by chance. I strongly recommend modifying the copy like this:
Code:
05 HIDDEN-RMC PIC X(2).
05 RPT-LN-ITEM-CNT PIC S9(3) COMP-3.
05 LINE-DATA-OCCURS OCCURS 1 TO 65 TIMES
     DEPENDING ON RPT-LN-ITEM-CNT
     INDEXED BY LN-INDX.
    10 HS-SVC-CD PIC X(3).
    10 RPT-HML-PRCG-SVC-CD PIC X(03).

or like that:
Code:
10 HIDDEN-RMC PIC X(2).
10 RPT-LN-ITEM-CNT PIC S9(3) COMP-3.
10 LINE-DATA-OCCURS OCCURS 1 TO 65 TIMES
     DEPENDING ON RPT-LN-ITEM-CNT
     INDEXED BY LN-INDX.
    12 HS-SVC-CD PIC X(3).
    12 RPT-HML-PRCG-SVC-CD PIC X(03).
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Sep 01, 2006 4:15 am    Post subject: Re: comparing fields with occurs clause
Reply with quote

Mercy,

Your ques is incomplete. You must tell us the 01 levels that the copybook appears in or is the 01 level in the copybook?

The ans you want depends on us knowing this fact. Show us as much as you can if you want us to be of any help.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm

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