View previous topic :: View next topic
|
Author |
Message |
Luizsergio
New User
Joined: 05 Jun 2008 Posts: 3 Location: Brazil, Rio de Janeiro
|
|
|
|
How to move FIELD-A appending to FIELD-B? |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Luiz,
Welcome to the forums.
Quote: |
How to move FIELD-A appending to FIELD-B? |
You will have to provide few more details about your requirement. What is the picture clause and the sample input and output. |
|
Back to top |
|
|
Luizsergio
New User
Joined: 05 Jun 2008 Posts: 3 Location: Brazil, Rio de Janeiro
|
|
|
|
Thanks for your answer...
I have something like this...
INPUT FILE
INPUT-HEADER PIC X (5).
INPUT-SEQ PIC 9 (1).
INPUT-DETAIL PIC X (2) OCCURS 620 TIMES.
LINKAGE
LINKAGE-HEADER PIC X (5)
LINKAGE-OUTPUT PIC X (32000).
IF DETAIL-HEADER EQUAL LINKAGE-HEADER
MOVE INPUT-DETAIL(IDX) NOT EQUAL SPACES TO LINKAGE-OUTPUT
APPENDING THE INPUT-DETAIL.
EXAMPLE
LINKAGE-HEADER = AAAAA
INPUT-HEADER = AAAAA
INPUT-SEQ = 1
INPUT-DETAIL = 3344552211
INPUT-HEADER = AAAAA
INPUT-SEQ = 2
INPUT-DETAIL = 993344
LINKAGE-OUTPUT = AAAAA13344552211AAAAA2993344 |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Code: |
IF INPUT-DETAIL (IDX) NOT = SPACES
MOVE SPACES TO LINKAGE-OUTPUT
MOVE INPUT-DETAIL(IDX) TO LINKAGE-OUTPUT (1 : 2)
MOVE INPUT-DETAIL (1 : 1240) TO LINKAGE-OUTPUT (3 : 1240)
END-IF.
|
|
|
Back to top |
|
|
Luizsergio
New User
Joined: 05 Jun 2008 Posts: 3 Location: Brazil, Rio de Janeiro
|
|
|
|
Thanks Craq Giegerich
Your solution is great, but I am needing something more effective because it is an online application. Using this logic it is taking so long to return the response.
Again, thank you for your response. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Luizsergio wrote: |
Thanks Craq Giegerich
Your solution is great, but I am needing something more effective because it is an online application. Using this logic it is taking so long to return the response.
Again, thank you for your response. |
You could leave out the move spaces but that isn't going to make a noticeable difference in response time, I think you need to look else where for inefficiencies. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
In COBOL when you're talking about appending data you're talking reference modification, which is not a fast process. If your online application is having response time issues with reference modification you may need to rethink the application logic. Tables may (or may not) buy some performance improvement, or perhaps you pass the data to a background task that can complete the reference modification while the transaction continues to handle user interactions. Another possibility would be to throw the data into a TDQ pointing to a sequential file and let a batch job do the appending. If you go the TDQ route, you'll want to close & open it regularly to flush the buffers for the batch job. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
What about using STRING instruction with the POINTER options.
So you don't need any reference modification.
Regards, UmeySan |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Robert Sample wrote: |
In COBOL when you're talking about appending data you're talking reference modification, which is not a fast process. If your online application is having response time issues with reference modification you may need to rethink the application logic. Tables may (or may not) buy some performance improvement, or perhaps you pass the data to a background task that can complete the reference modification while the transaction continues to handle user interactions. Another possibility would be to throw the data into a TDQ pointing to a sequential file and let a batch job do the appending. If you go the TDQ route, you'll want to close & open it regularly to flush the buffers for the batch job. |
Since neither of the reference modifications (1 :2) and (3 : 1240) involve any variables they are resolved to moves at compile time. If INPUT-DETAIL does not change between calls that move could be done just once. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Using this logic it is taking so long to return the response. |
The length of time is not due to those few moves.
Your performance problem is elsewhere.
I believe it is not possible to "see" the response time impact of an IF and 3 MOVEs. . . |
|
Back to top |
|
|
|