View previous topic :: View next topic
|
Author |
Message |
aman333
New User
Joined: 23 Nov 2012 Posts: 4 Location: india
|
|
|
|
Hi,
I am facing problem while moving EBCDIC values to alphanumeric field in COBOL.
Source Field
Code: |
.. .2...345566777867 - EBCDIC Value
1040F17BFFFFFFFFFFFF - HEX Value
320F2010345566777867 |
Destination Field
Code: |
2 ..345566777867
4444F47BFFFFFFFFFFFF
00002010345566777867 |
do we have any specific compile option for this, please help.
Code'd
Thanks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And the problem is? And the code you have is? Including field definitions. In the Code tags, please. |
|
Back to top |
|
|
aman333
New User
Joined: 23 Nov 2012 Posts: 4 Location: india
|
|
|
|
Problem is that values of source field are getting changed. Hex values should be same for source and destination , but as you can see values are different. We are receiving input file from other system, and we have been told that values in VAR-MISC-DA will be in EBCDIC format.
Please find below code we are using for move:
Code: |
SELECT INPUT-FILE ASSIGN TO INFILE
FILE STATUS IS INFILE-STATUS.
FD INPUT-FILE
RECORDING MODE IS V
RECORD VARYING 1 TO 4109 CHARACTERS
LABEL RECORDS ARE STANDARD.
01 INFILE-RECORD.
05 IN-FIXED-PORTION.
10 FILLER PIC X(179).
10 RSI-KEY PIC X(114).
10 FILLER PIC X(276).
10 VAR-FLD-CT PIC 999.
05 IN-VARIABLE-PORTION OCCURS 25 TIMES
DEPENDING ON VAR-FLD-CT.
10 VAR-NM PIC X(5).
[b][color=red] 10 VAR-MISC-DA PIC X(125). [/b[/color]]
01 RSIR-RECORD.
COPY RSIR.
.
.
.
03 LETTER-VARIABLE-SEGMENT.
05 VARIABLE-COUNT PIC 9(03).
05 VARIABLES OCCURS 25 TIMES
DEPENDING ON VARIABLE-COUNT.
10 VARIABLE-NAME PIC X(05).
[b] [color=red]10 VARIABLE-DATA PIC X(125). [/b]
.[/color] .
C0000-MAIN-PROCESS.
MOVE SPACES TO RSIR-RECORD.
[b]READ INPUT-FILE INTO RSIR-RECORD [/b] AT END SET INPUT-EOF TO TRUE
END-READ.
After above read statement , values in VAR-MISC-DA are moved to VARIABLE-DATA, here values are getting changed. I have mentioned source and destination field values earlier. please have a look.
Thanks. |
Mr Woodger asked IN CODE TAGS |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Kindly show us the MOVE statement too |
|
Back to top |
|
|
aman333
New User
Joined: 23 Nov 2012 Posts: 4 Location: india
|
|
|
|
Values are getting moved by
READ INPUT-FILE INTO RSIR-RECORD
INPUT-FILE values ----->>> RSIR-RECORD values
Field definitions have already shared above.
PIC values of both fields are same X(125). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Aman333, so far you have provided ZERO information that we can use to help you.
How does RSIR-RECORD relate to your source and destination fields in your original post? Source and destination implies a MOVE of some kind -- so why are you refusing to show us the MOVE statement?
You ARE aware, I hope, that reading variable length records the way you are, that you cannot rely upon anything after the number of occurrences your record specifies in VARIABLE-COUNT or VAR-FIELD-CT? And that there may be left over data in the buffer from a previous record -- which is one reason we recommend not using the buffers as you are in COBOL? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Aman333,
How did you become aware of what you think is happening? You are showing values, but where did you get those values?
Which Cobol compiler are you using? Robert is correct in how ODO works prior to Enterprise Cobol, and I personally still feel it is good practice to always ensure that the ODO Object contains a logical value.
I can see nothing actually wrong with your READ INTO. This will "MOVE" chunks of data, there is nowhere that it does something to part of the data along the way.
If your values are not what you expect, you are either clobbering them in the program, or using the wrong index/subscript to reference them or otherwise have coded for this particular result to occur, even though you are unaware of it.
Start by saying where/how you got those results. Then go "backwards" through the process of everything in your program which references those things, directly, indirectly, at group or individual level, through CALLs or whatever, until you reach the READ INTO.
If you haven't found it by then, at least you have everything ready to post. |
|
Back to top |
|
|
aman333
New User
Joined: 23 Nov 2012 Posts: 4 Location: india
|
|
|
|
I came to know about what is happening by using display statements. Displayed values of infile-records and RSIR-RECORD and got to know difference.
One thing to note here is that while I am browsing the input file , values are different and in display statement values are different. e.g
In 3.4 option file values are
.. .2...345566777867
While in display statement value is:
2 ..345566777867
dots are getting replaced by spaces as shown above.
I am not sure what more information do you guys need |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you show the DISPLAY statements? Also definition and all references to the subscript/index you use for the DISPLAY (if you do).
Can you show the copybook?
With non-displayable characters, ISPF shows ".", so no mystery there.
As you have non-displayable characters, please show results of DISPLAY in HEX (as you did first). In the Code tags. Note that other formatting does not work inside the Code tags, so don't try it. Use the Preview button to see how your post will look, and correct formatting where necessary. |
|
Back to top |
|
|
Simone Salzmann
New User
Joined: 26 Nov 2012 Posts: 17 Location: Switzerland
|
|
|
|
Hi, Aman
your last post looks very like as if the difference in the display in 3.4 and in COBOL is due to the fact that the record length and the block length are omitted in COBOL.
(Each uses two bytes at the beginning of the record)
That would correspond with the fact "Recording Mode V(ariable)" you showed in your second post.
This is not a bug but a feature.
COBOL handles the varying record length (and the block length) itself, you don't have to care for it in your program.
What's shows in position 5 in function 3.4 would be position 1 in COBOL.
Only thing: I haven't had a look into variable files in 3.4 for quite a while and can't be sure on the behavior of this function. Maybe somebody can confirm or deny my assumption. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
From the original post, which is in hex, the display starts with a four-byte unsigned packed field.
The leftmost "13" take the "record-length" (if it were that) well beyond the 4109 shown under the FD and the "IOCS" (the last two bytes of the potential RDW) are neither binary zero nor what would be expected for any record from a VBS/VS.
The silence may indicate a simple record-layout mismatch, or not accounting for the RDW between the two displays. |
|
Back to top |
|
|
|