What is the use of ASSIGN #MESSAGE-CONTENT =



Software AG's platform-independent programming language with full support for open-source and Internet applications

What is the use of ASSIGN #MESSAGE-CONTENT =

Postby diptisaini » Mon May 24, 2010 11:21 am

Define data local
1 #KCSWIFTA-PARMS
2 #KCSWIFTA-IN-PARMS
3 #KCSWIFTA-IN-CHAR A 1
R 3 #KCSWIFTA-IN-CHAR
4 #KCSWIFTA-IN-CHAR-ARRAY A 100
3 #KCSWIFTA-IN-LENGTH N 5
2 #KCSWIFTA-OUT-PARMS
3 #KCSWIFTA-OUT-BASIC-HEADER
4 #KCSWIFTA-OUT-BH-APPL-ID A 1
4 #KCSWIFTA-OUT-BH-SERVICE-ID N 2
4 #KCSWIFTA-OUT-BH-ORIG-ADDR A 12
4 #KCSWIFTA-OUT-BH-SESSION-NO N 4
4 #KCSWIFTA-OUT-BH-MSG-SEQ-NO N 6
3 #KCSWIFTA-OUT-OUTPUT-APPL-HEADER
4 #KCSWIFTA-OUT-OH-IO-TYPE A 1
4 #KCSWIFTA-OUT-OH-MSG-TYPE N 3
4 #KCSWIFTA-OUT-OH-INPUT-DATE D
4 #KCSWIFTA-OUT-OH-INPUT-TIME T
01 #IDX-1 (N05)
01 #IDX-2 (N05)
end-define
FOR #IDX-1 1 TO C*MESSAGE-CONTENT
ASSIGN #MESSAGE-CONTENT =
INCOMING-MESSAGE-QUEUE.MESSAGE-CONTENT(#IDX-1)
FOR #IDX-2 1 TO 100
ADD 1 TO #KCSWIFTA-IN-LENGTH
ASSIGN #KCSWIFTA-IN-CHAR ( #KCSWIFTA-IN-LENGTH) :=
#MESSAGE-CONTENT-BYTES ( #IDX-2 )
END-FOR

What is the use of ASSIGN #MESSAGE-CONTENT =
INCOMING-MESSAGE-QUEUE.MESSAGE-CONTENT(#IDX-1) statement ?
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

 

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby RGZbrog » Mon May 24, 2010 12:31 pm

The code is easier to read with indentation, and easier to reference with line numbers.
0010 FOR #IDX-1 1 TO C*MESSAGE-CONTENT
0020   ASSIGN #MESSAGE-CONTENT = INCOMING-MESSAGE-QUEUE.MESSAGE-CONTENT (#IDX-1)
0030   FOR #IDX-2 1 TO 100
0040     ADD 1 TO #KCSWIFTA-IN-LENGTH
0050     ASSIGN #KCSWIFTA-IN-CHAR (#KCSWIFTA-IN-LENGTH) = #MESSAGE-CONTENT-BYTES (#IDX-2)
0060   END-FOR
0070 END-FOR

    Line 0010 tells us that MESSAGE-CONTENT is a multiple occurrence field retrieved from Adabas. We'll process all occurrences returned in the view.

    In Line 0020 we move each individual occurrence to a temporary variable, #MESSAGE-CONTENT. Line 0050 tells us that the variable is redefined as a vector. Since the index, #IDX-2, varies from 1 to 100 in Line 0030, we know that #MESSAGE-CONTENT has (at least) 100 bytes.

    The loop in Line 0030 processes the 100 bytes of #MESSAGE-CONTENT.

    In the input parameter list, #KCSWIFTA-IN-LENGTH appears to contain the number of significant positions in #KCSWIFTA-IN-CHAR. Line 0040 points us to the next available position.

    Line 0050 moves the "next" byte of #MESSAGE-CONTENT to the "next" byte of #KCSWIFTA-IN-CHAR.
Since #KCSWIFTA-IN-CHAR would typically overflow after the completion of the FOR loop at Line 0030, I presume that you have excluded some ESCAPE logic which is used to limit processing to the significant characters of #MESSAGE-CONTENT-BYTES. If that is true, then this appears to be a long-winded attempt to append the contents of MESSAGE-CONTENT to #KCSWIFTA-IN-CHAR, so you could replace both loops with a single statement:
COMPRESS #KCSWIFTA-IN-CHAR-ARRAY
         INCOMING-MESSAGE-QUEUE.MESSAGE-CONTENT (*)
    INTO #KCSWIFTA-IN-CHAR-ARRAY LEAVING NO SPACE
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby diptisaini » Mon May 24, 2010 2:22 pm

*
1 #KCSWIFTA-PARMS
2 #KCSWIFTA-IN-PARMS
3 #KCSWIFTA-IN-CHAR A 1 (1:10000
R 3 #KCSWIFTA-IN-CHAR /* REDEF
4 #KCSWIFTA-IN-CHAR-ARRAY A 100 (1:100)
3 #KCSWIFTA-IN-LENGTH N 5
Below is the data available in adabas file :-

C*Message-content........ 5
Message-content(001)..... :16R:GENL??:20C::SEME//SYTBFRL3H0604462??:23G:NEWM??
:16R:LINK??:20C::RELA//SYTBFRL3H??:16S:LINK??:16
Message-content(002)..... S:GENL??:16R:TRADDET??:98A::SETT//20090630??:98A::TR
AD//20090623??:35B:ISIN AU000000STO6??SANTOS NPV
Message-content(003)..... ??:16S:TRADDET??:16R:FIAC??:36B::SETT//UNIT/1375,??:
97A::SAFE//11007??:16S:FIAC??:16R:SETDET??:22F::
Message-content(004)..... SETR//TRAD??:16R:SETPRTY??:95Q::DEAG//PHYSICAL RECEI
PT AUSTRALIA??:16S:SETPRTY??:16R:SETPRTY??:95Q::
Message-content(005)..... SELL//PHYSICAL RECEIPT??:16S:SETPRTY??:16R:SETPRTY??
:95P::PSET//CAETAU21??:16S:SETPRTY??:16S:SETDET

ASSIGN #KCSWIFTA-IN-CHAR (#KCSWIFTA-IN-LENGTH) = #MESSAGE-CONTENT-BYTES (#IDX-2) then what would be the value of #KCSWIFTA-IN-CHAR ,#KCSWIFTA-IN-LENGTH and #MESSAGE-CONTENT-BYTES ?
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby diptisaini » Mon May 24, 2010 2:27 pm

FOR #IDX-1     1 TO C*MESSAGE-CONTENT                         
     ASSIGN #MESSAGE-CONTENT =                                 
            INCOMING-MESSAGE-QUEUE.MESSAGE-CONTENT(#IDX-1)     
     FOR #IDX-2     1 TO 100                                   
         ADD     1 TO #KCSWIFTA-IN-LENGTH                       
         ASSIGN #KCSWIFTA-IN-CHAR      ( #KCSWIFTA-IN-LENGTH) :=
                #MESSAGE-CONTENT-BYTES ( #IDX-2 )               
     END-FOR                                                   
 END-FOR                                                       
                                         
 CALLNAT 'KCSWIFTN' #KCSWIFTA-PARMS


I just need to know what is the flow of this program ?
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby RGZbrog » Mon May 24, 2010 10:27 pm

Forums such as this are intended for brief answers to straightforward questions. For a code walkthrough, you need to see your mentor or tech lead.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby diptisaini » Tue May 25, 2010 3:25 pm

My team lead is on leave and i have to complete this assigment by tomorrow only. So can anyone help me on this topic ?
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: What is the use of ASSIGN #MESSAGE-CONTENT =

Postby dick scherrer » Wed May 26, 2010 12:04 am

Hello,

It is quite ill-advised to bring critical needs to a forum. . . It is just too likely that no one will be available right away.

For the kind of questions you have in this topic, i believe you could get much faster answers by simply running a few experiments on your system. You would have instant feedback and could run many such experiments in a very short time.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6284
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 92 times


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post