I'm trying to display some data that I'm reading into a table. However, I keep getting the error:
IN-FUND-NBR was not a uniquely defined name...Expected a reference-modification specification but found ")".
***EDIT: Okay, so I found the root of the problem. However, can't I still access IN-FUND-NBR as it sits? I tried the following, but it does not work:
DISPLAY "IN-FUND-NBR = " IN-FUND-NBR (MF-SALE-SUB) OF IN-MF-SALE
***END EDIT
I have the following record defined as follows:
01 SALES-RECORD.
05 IN-CITY-NAME PIC X(20).
05 IN-CUSTOMER-NAME PIC X(20).
05 IN-MF-SALE OCCURS 4.
10 IN-FUND-NBR PIC 9(2).
10 IN-PRICE-FLAG PIC 9.
10 IN-PURCH-AMT PIC 9(5)V99.
I'm trying to extract the first instance of IN-FUND-NBR by doing the following in a paragrah:
PERFORM
VARYING MF-SALE-SUB FROM 1 BY 1
UNTIL MF-SALE-SUB > 4
DISPLAY "Fund Number: " IN-FUND-NBR(MF-SALE-SUB)
END-PERFORM.
In your program you have IN-FUND-NBR defined more than once. The other definition(s) may be in a copybook, or something you have coded yourself without realising. The compiler discards the reference to the field.
The second diagnostic message about the reference-modification is because having discarded the reference to your data-name the compiler then encounters the opening parenthesis and your subscript. This message will disappear when you correct the problem.
Either, ensure that the data-names are unique. Or, in the nutty situation that this is not possible, you have to use qualification. You do this by using IN or OF and referencing a higher level data-name.
From what you have shown:
DISPLAY "Fund Number: " IN-FUND-NBR OF SALES-RECORD (MF-SALE-SUB)
should work.
Although you can use qualificationto get around the problem, many are like me and find it a complete waste of time and patience, and others, especially beginners, find it a source of confusion. Try your best to always have unique data-names.
Related
I am stuck with some mysterious issue while trying to get Revenue for Current Month.
My Limitation is Simple :
I need Current Month Revenue Without Having to do any selections.
So here are the details :
Data_Date field has two values one for Dec, and one for Nov 2016
11/15/2016
12/15/2016
I have declared a variable vCurrent_Month
=Date#( Max(Data_Date))
Value in Variable is correctly Reflecting 12/15/2016
Given below is my Set Analysis Expression used in Text Object:
=Sum({1<Date#(Data_Date)={"(vCurrent_Month)"}>}TOTAL_REVENUE)
I am getting following error
Error: Error in set modifier expression
I have been stuck for hours and I have tried several tutorials and ways to get the same result but there seems to be no way out. Any help is highly appreciated.
Thanks
Try this:
=Sum({1<Data_Date={'$(vCurrent_Month)'}>}TOTAL_REVENUE)
Trying to do the number formatting in the first part of the set analysis is what is causing the error message you're getting.
After that to get it to work you need to make these changes:
You left out the $() expansion then the variable won't evaluate and you used double quotes which will return a field name rather than a value
I'm using system to control the process in my company and some of it has comment table, let us say it is Opr_comm. the content inside that attribute is various sometimes it contain "<", ">", "'" and so many symbols. here is the query.
SELECT
T1.Prod_No,
T1.Proc_CD,
T1.Opr_Comm
FROM
P110 T1
I have figure it out, when we input to system < it will turned to be <, when > it will be >. it happen when i retrieve it from database.
So, how can i convert that code to be symbol again?
Thank you very much for your help
If you're just looking to convert back to symbols when you are reading from the table, and not during the write process, you can use the REPLACE function
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions134.htm
It's bulky, but if this is a limited issue it will work. You'd replace your code:
SELECT
T1.Prod_No,
T1.Proc_CD,
replace(replace(T1.Opr_Comm,"<","<"),">",">") AS Opr_Comm
From
P110 T1
Of course if you're able to prevent this encoding from happening in the first place, you'd be better off.
I'm sorry if this question has been already answered, I've tried to search all over this site and I couldn't find anything.
I created a calculator that receives value and option from Mainframe Replies and then does the arithmetic operations.
My main problem is that if I declare a pic 9(3) and the value is 2 it'll display this way:
200 instead of 2.
How could I format this in order to avoid this problem?
Thank you!
For several reasons, I suggest something along these lines rather than what has already been suggested: your input field is short, so no real problem with dealing with individual names for three fields; you need to validate the input before calculating; it'll give you some practice with COBOL field definitions; it is the way I'd do it for this case (short, simple-format, data, requiring validation).
The procedure code is simple, and can be structured in any number of ways.
Your data may be: 4+ characters (invalid), zero characters (invalid), three characters, two characters, one character, and must be numeric (you haven't mentioned it is a Hex Calculator) for these last three, otherwise invalid.
Make the procedure code reflect that.
To keep things simple, deal with the major invalid data first (too long, too short) and don't let that near the rest of the processing.
With those out of the way, it is easy to identify input of one character (two trailing spaces) then two characters (now the only remaining possibility when space in third position) then what is left must be three characters.
Having given each field an individual name, they can be tested for NUMERIC in their own piece of code (I like to de-clutter IF/EVALUATE by using PERFORM, but many don't) and simply MOVEd to a PIC 999/9(3) field if valid.
The PIC 999/9(3) field can be defined as COMP-3/PACKED-DECIMAL. An alpha-numeric (PIC X...) field can be moved directly to that. The reason you may want to do this is because we know for sure it is going in to a calculation, which means the compiler will have to convert it to packed-decimal anyway, so you can consider the conversion up-front. If all other fields in your calculation are binary, you could subsequent to the first MOVE, do a second move to a COMP/COMP-4/BINARY/COMP-5 field (you cannot directly MOVE a PIC X... to a binary field).
01 INPUT-LINE.
05 INPUT-VALUE.
88 IV-NO-VALUE VALUE SPACE.
10 IV-THREE-DIGITS.
15 IV-TWO-DIGITS.
20 IV-ONE-DIGIT PIC X.
20 FILLER PIC X.
15 FILLER PIC X.
88 IV-ONE-TRAILING-BLANK
VALUE SPACE.
05 FILLER REDEFINES INPUT-VALUE.
10 FILLER PIC X.
10 FILLER PIC XX.
88 IV-TWO-TRAILING-BLANKS
VALUE SPACE.
05 FILLER PIC X(77).
88 IV-NO-EXTRA-DATA VALUE SPACE.
01 INPUT-VALUE-FOR-CALCULATION PIC 9(3).
PERFORM VALIDATE-INPUT
VALIDATE-INPUT.
IF IV-NO-EXTRA-DATA
EVALUATE TRUE
WHEN IV-NO-VALUE
set some unique error
WHEN IV-TWO-TRAILING-BLANKS
PERFORM ONE-INPUT-CHARACTER
WHEN IV-ONE-TRAILING-BLANK
PERFORM TWO-INPUT-CHARACTERS
WHEN OTHER
PERFORM THREE-INPUT-CHARACTERS
END-EVALUATE
ELSE
set some unique error
END-IF
ONE-INPUT-CHARACTER.
IF IV-ONE-DIGIT NUMERIC
MOVE IV-ONE-DIGITS TO INPUT-VALUE-FOR-CALCULATION
ELSE
set some unique error
END-IF
TWO-INPUT-CHARACTERS.
IF IV-TWO-DIGITS NUMERIC
MOVE IV-TWO-DIGITS TO INPUT-VALUE-FOR-CALCULATION
ELSE
set some unique error
END-IF
THREE-INPUT-CHARACTERS.
IF IV-THREE-DIGITS NUMERIC
MOVE IV-THREE-DIGITS TO INPUT-VALUE-FOR-CALCULATION
ELSE
set some unique error
END-IF
You're a beginner, so you haven't wondered exactly why you ended up with 200.
ACCEPT, on the Mainframe, does not do numeric alignment, because ACCEPT is actually taking all the data that is available, slapping it into your field, and truncating any excess.
So that will get you 2 (that is two trailing blanks). Your field is PIC 999/9(3), so it is unsigned. Because it is unsigned the compiler will ensure that it is so when it is used as the source of a VERB. This will give you 2 0, because the left-hand part of the third byte (on the Mainframe) will be set to F from 4. X'40' is a space, which it was originally. X'F0' is zero, which is what you get when the 4 is changed to an F.
You still have that space in the middle. However, by the time you use that field for a calculation, all the left-parts of each byte (except the sign in the final one) will be stripped out to "pack" the field, and to put a result back in a PIC 999/9(3) Fs will simply be inserted as part of the "unpack". Lo, your two followed by two blanks is now 200!
As I understood, select-options in abap just takes 45 characters from UI.
Whatever I assign the type of select-option, it doesnt take more then 45 characters.
SELECT-OPTIONS: s_key FOR somlreci1-receiver NO INTERVALS VISIBLE LENGTH 100.
somlreci1-receiver is char(1215). But I cannot write more than 45 into that select-option.
Any way to increase this length ?
This official link
http://help.sap.com/abapdocu_70/en/ABAPSELECT-OPTIONS.htm
says it isn't possible to pass input larger than 45 chars, sorry :|
At the end of the documentation posted by #vlad-ardelean it mentions that:
If a selection criterion for data types is supplied with data when
calling up an executable program with SUBMIT
...
If the selection criterion is declared with the addition NO-DISPLAY,
no conversion routine or truncation will be performed for the first
row either.
You could declare the select-options as NO-DISPLAY in your main program, then call it from a second program with
SUBMIT programname WITH so_field EQ lv_longdata SIGN 'I'.
...or similar to pass the long value to the main program. It's a pretty convoluted way of doing it, however.
In addition to #vlad-ardelean's answer: It might be interesting to note that in recent releases, the maximum field length was raised to 255 characters (see http://help.sap.com/abapdocu_731/en/ABAPSELECT-OPTIONS.htm).
First, i admit all the things i will ask are about our homework but i assure you i am not asking without struggling at least two hours.
Description: We are supposed to add a field called max_cpu_percent to task_struct data type and manipulate process scheduling algorithm so that processes can not use an higher percentage of the cpu.
for example if i set max_cpu_percent field as 20 for the process firefox, firefox will not be able to use more than 20% of the cpu.
We wrote a system call to set max_cpu_percent field. Now we need to see if the system call works or not but we could not get the value of the max_cpu_percent field from a user-spaced program.
Can we do this? and how?
We tried proc/pid/ etc can we get the value using this util?
By the way, We may add additional questions here if we could not get rid of something else
Thanks All
Solution:
The reason was we did not modify the code block writing the output to the proc queries.
There are some methods in array.c file (fs/proc/array.c) we modified the function so that also print the newly added fields value. kernel is now compiling we'll see the result after about an hour =)
It Worked...
(If you simply extended getrlimit/setrlimit, then you'd be done by now…)
There's already a mechanism where similar parts of task_struct are exposed: /proc/$PID/stat (and /proc/$PID/$TID/stat). Look for functions proc_tgid_stat and proc_tid_stat. You can add new fields to the ends of these files.