ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

XLATE opcode in RPG

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XLATE opcode in RPG

    Code:
    D Up              C                   'ABCDEFGHIJKLMNOPQRS-
    D                                        'TUVWXYZ'
    D Lo              C                   'abcdefghijklmnopqrs-
                                               'tuvwxyz'
    C                   MOVE             'rpg dept'    String            8
    C     Lo:Up     XLATE            String        Result
    What will be the value of Result??
    and Why??

    regards,
    SWARUP

  • #2
    Re: XLATE opcode in RPG

    Just enter the snippet into a source file, compile it and debug it (or display the result by using the OPCode DSPLY).

    For more information have a look into the RPG Reference:
    XLATE (Translate)

    The example you posted is even an example out of the RPG Reference!!!!


    Birgitta

    Comment


    • #3
      Re: XLATE opcode in RPG

      Originally posted by B.Hauser View Post
      Just enter the snippet into a source file, compile it and debug it (or display the result by using the OPCode DSPLY).

      For more information have a look into the RPG Reference:
      XLATE (Translate)

      The example you posted is even an example out of the RPG Reference!!!!


      Birgitta
      The value of Result will be 'RPG DEPT',
      but why is't so??
      in translate operation I have given LO:UP .
      what's the meaning of the separator between LO and UP i.e. `:`
      and how it works??
      that I still really couldn't understand ?

      regards,
      SWARUP

      Comment


      • #4
        Re: XLATE opcode in RPG

        if you can't understand the VERY simple instructions, graph etc shown in that VERY simple example then perhaps you should consider a class in reading comprehension as well as the RPG course you are currently failing..
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: XLATE opcode in RPG

          we all had to start some where....

          1 - XLATE is the operation code which means - translate
          2 - factor 1 (lo:up) is the input for the operation ie: take the LO characters and translate them to UP characters
          3 - factor 2 (string) is the field that is being translated
          4 - result (result) is the result of the operation

          Most importantly, unless you have flame proof underwear, always remember to http://lmgtfy.com/?q=rpg+xlate

          predictably positive, permanently punctilious, purposely proactive, potentially priceless, primarily professional : projex

          Comment


          • #6
            Re: XLATE opcode in RPG

            ...and for Thors sake dont ask what move does!

            /me crawls back into his cubicle talking to himself, twitching and swatting imaginary insects
            predictably positive, permanently punctilious, purposely proactive, potentially priceless, primarily professional : projex

            Comment


            • #7
              Re: XLATE opcode in RPG

              Originally posted by Finkpad View Post
              we all had to start some where....
              and that somewhere was generally to RTFM...and in today's world it's even easier with Google, Bing, , etc. maybe it's just me but in the time it takes to post the question here they could have tons of relevant information about these RPG 101 questions, so why not take those few seconds? and in this case the OP actually found the code IN the RPG reference manual fer crying out loud. i went to the link Birgitta posted and the opcode syntax, usage, etc are spelled out in 1st grade equivalent language!
              I'm not anti-social, I just don't like people -Tommy Holden

              Comment


              • #8
                Re: XLATE opcode in RPG

                aaannnnnndddd..... breathe.....

                predictably positive, permanently punctilious, purposely proactive, potentially priceless, primarily professional : projex

                Comment


                • #9
                  Re: XLATE opcode in RPG

                  Originally posted by Finkpad View Post
                  we all had to start some where....

                  1 - XLATE is the operation code which means - translate
                  2 - factor 1 (lo:up) is the input for the operation ie: take the LO characters and translate them to UP characters
                  3 - factor 2 (string) is the field that is being translated
                  4 - result (result) is the result of the operation

                  Most importantly, unless you have flame proof underwear, always remember to http://lmgtfy.com/?q=rpg+xlate

                  D ABC C 'SNGRATE'
                  D XYZ C 'SRBPEU@`
                  C MOVE 'STRANGE' String 7
                  C ABC:XYZ XLATE String Result

                  so is Result will contain 'SUPERB@` after XLATE...????

                  sorry for asking very very simple question,but anyway Im too new for it, only for 7days Iv seen AS400.

                  thanks for answering, and always will except the answer from you all.

                  regards,
                  SWARUP

                  Comment


                  • #10
                    Re: XLATE opcode in RPG

                    Correct!

                    Heres a very simple way of testing the code example:

                    Code:
                    D ABC             C                   'SNGRATE'                   
                    D XYZ             C                   [EMAIL="'SRBPEU@'"]'SRBPEU@'[/EMAIL]                   
                    C                   MOVE      'STRANGE'     String            7   
                    C     ABC:XYZ       XLATE     String        Result            7   
                     * display the value of field 'RESULT' to the screen              
                    C     RESULT        DSPLY                                         
                     * end this silly little thing                                    
                    C                   eval      *inlr = *on
                    predictably positive, permanently punctilious, purposely proactive, potentially priceless, primarily professional : projex

                    Comment


                    • #11
                      Re: XLATE opcode in RPG

                      In the "old days" (god that makes me feel old) all we had was the manuals and our peers.
                      Seems these days newbies either don't have peers to turn to, or are scared to ask questions.
                      Either way it's (a) scary for the future of computing and (b) job security for us.

                      Makes me wonder how many are mis-interpreting the Yoda Jedi Manual.

                      When Yoda said "there is no try" he meant do not try, but do and succeed.

                      Seems some people are assuming this to mean do not try - get someone else to do it instead.

                      I love Finkpad's comment...
                      /me crawls back into his cubicle talking to himself, twitching and swatting imaginary insects
                      Poddys Rambles On

                      Comment


                      • #12
                        Re: XLATE opcode in RPG

                        We we first started to learn this stuff, all the materials and the teachers were in a language and culture we knew. Other than those individuals looking for test answers or trying to get someone to do there work for them. I wouldn't be surprised if there is a language and or culture issues going on that causes confusion on some of those trying to ask legit questions.

                        Comment


                        • #13
                          Re: XLATE opcode in RPG

                          Originally posted by DAG0000 View Post
                          We we first started to learn this stuff, all the materials and the teachers were in a language and culture we knew. Other than those individuals looking for test answers or trying to get someone to do there work for them. I wouldn't be surprised if there is a language and or culture issues going on that causes confusion on some of those trying to ask legit questions.
                          You could be right. We were always taught to ask questions if we weren't sure, and from the number of posts on AS400 forums in the last 3-4 years from newbies, it seems like that is not happening. It's like they are expected to find out for themselves, whereas a combination of reading the manuals and seeking knowledge from your peers always worked in the past.

                          I read the manuals to gleam everything that I can, always did, still do, but there is no substitute for asking someone knowledgeable. It always used to be within your same company/dept.
                          Poddys Rambles On

                          Comment

                          Working...
                          X