here is my requirement
A1 is alphanumeric with value 'A1B2C3D4' as defined below
05 A1 PIC X(8) VALUE IS 'A1B2C3D4'
but i need to have A2,A3 as ABCD & 1234 repectively......
A2 = ABCD
A3 = 1234
Can you please explain me what are the different ways to do it?
Answer Posted / mainframe guy
You can also do it this way:
DATA DIVISION
01 A1 VALUE 'A1B2C3D4'
05 A1-CHAR PIC X(01) OCCURS 8.
01 A2 PIC X(04) VALUE SPACES.
01 A3 PIC X(04) VALUE SPACES.
01 I PIC 9(02) VALUE ZEROS.
01 J PIC 9(02) VALUE ZER0S.
01 K PIC 9(02) VALUE ZEROS.
PROCEDURE DIVISION.
MOVE 1 TO I J K
PERFORM VARYING I FROM 1 BY 1 UNTIL WS-I > 8
IF A-CHAR(I) IS NUMERIC
MOVE A-CHAR(I) TO A3(K:1)
ADD 1 TO K
ELSE
MOVE A-CHAR(I) TO A2(J:1)
ADD 1 TO J
END-IF
END-PERFORM
Now you will have A2 = ABCD and A3 = 1234
This method can be used only if you want to seperate numbers
from alphabets. Otherwise, the previous solution has to be used.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
how to move the records from file to array table. give with code example
what are decleratives in cobol?
What is report-item in COBOL?
What is the difference between perform … with test after and perform … with test before?
I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
What is the difference between Call and a Link?
What are literals?
How do u write test cases?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
What is rmode(24)
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
What is the difference between external and global variables in COBOL?
How many bytes S(8) comp field occupy and its maximum value?