IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to move FIELD-A appending to FIELD-B


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Luizsergio

New User


Joined: 05 Jun 2008
Posts: 3
Location: Brazil, Rio de Janeiro

PostPosted: Fri Jun 13, 2008 6:17 pm
Reply with quote

How to move FIELD-A appending to FIELD-B?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Jun 13, 2008 6:56 pm
Reply with quote

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
View user's profile Send private message
Luizsergio

New User


Joined: 05 Jun 2008
Posts: 3
Location: Brazil, Rio de Janeiro

PostPosted: Sat Jun 14, 2008 12:57 am
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Jun 14, 2008 1:37 am
Reply with quote

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
View user's profile Send private message
Luizsergio

New User


Joined: 05 Jun 2008
Posts: 3
Location: Brazil, Rio de Janeiro

PostPosted: Mon Jun 16, 2008 7:27 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 16, 2008 7:39 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 16, 2008 8:44 pm
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Jun 16, 2008 8:54 pm
Reply with quote

Hi !

What about using STRING instruction with the POINTER options.
So you don't need any reference modification.

Regards, UmeySan
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 16, 2008 9:04 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 16, 2008 9:15 pm
Reply with quote

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. . . icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top