ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Formatting 6,0 field as time with colons

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

  • Formatting 6,0 field as time with colons

    Is there an easy way to get this (101455) to this (10:14:55) in ILE?

    Please no FREE - I can;'t use use it even if I wanted.

    Mike.
    Everyday's a school day, what grade are you in?

  • #2
    An edit word should do it. Haven't coded any in years but something like:

    editVal = $EditW( numVal : '00:00:00');

    Yes - that's free-form but I'm sure you can translate - I haven't coded in fixed form in more than 10 years. Don't know why you can't use free-format, I guess your company has decided to stay in the 20th century until such time as they can get rid of the IBM i because it is "old-fashioned" <sigh>

    Comment


    • #3
      Excellent, I knew there had to be a fast way. (I won't tell you what I did to accomplish it, it's embarrassing.)
      Everyday's a school day, what grade are you in?

      Comment


      • #4
        Originally posted by JonBoy View Post
        An edit word should do it. Haven't coded any in years but something like:

        editVal = $EditW( numVal : '00:00:00');

        Yes - that's free-form but I'm sure you can translate - I haven't coded in fixed form in more than 10 years. Don't know why you can't use free-format, I guess your company has decided to stay in the 20th century until such time as they can get rid of the IBM i because it is "old-fashioned" <sigh>
        Not much different really - fixed format you just put the EVAL in front of it....

        Code:
        C                   EVAL      TimChar = %EDITW(TimNum:'  :  : 0')

        Comment


        • #5
          Originally posted by Rocky View Post

          Not much different really - fixed format you just put the EVAL in front of it....
          Really Rocky ... I'm shocked!

          Comment


          • #6
            Originally posted by redvan View Post
            Excellent, I knew there had to be a fast way. (I won't tell you what I did to accomplish it, it's embarrassing.)
            If I was unable to use BIFs (yes - sadly I have met some shops where they were restricted for some god forsaken reason) or if the editing was beyond the scope of edit words then this approach works just fine: I'm doing this in free because I don't have time to mess with columnar DS)
            Code:
            dcl-ds  *n;
              input  zoned(6);
              part1   char(2)  overlay(input);
              part2   char(2)  overlay(input : *Next);
              part3   char(2)  overlay(input : *Next);
            end-ds;
            
            input = TimNum;
            output = part1 + ':' + part2 + ':' + part3;

            Comment


            • #7
              Originally posted by JonBoy View Post

              Really Rocky ... I'm shocked!
              That's what happens when you put your keys into the light socket... just sayin'

              Comment


              • #8
                Originally posted by JonBoy View Post
                Don't know why you can't use free-format, I guess your company has decided to stay in the 20th century until such time as they can get rid of the IBM i because it is "old-fashioned" <sigh>
                I doubt any company which views IBM/i as old fashioned does so because of free or fixed RPG, most likely it's because of a lack of a standard GUI.

                Comment


                • #9
                  Originally posted by UserName10 View Post

                  I doubt any company which views IBM/i as old fashioned does so because of free or fixed RPG, most likely it's because of a lack of a standard GUI.
                  I meant that it was symptomatic ... not that the specific RPG usage was the only factor.

                  But I think you're wrong about the "standard GUI". "The" standard these days is the browser - even on Windows boxes. IBM i supports that very well with a wide variety of languages. After all Linux is a major presence in the market these days but it has no standard GUI.

                  Comment


                  • #10
                    Originally posted by JonBoy View Post

                    I meant that it was symptomatic ... not that the specific RPG usage was the only factor.

                    But I think you're wrong about the "standard GUI". "The" standard these days is the browser - even on Windows boxes. IBM i supports that very well with a wide variety of languages. After all Linux is a major presence in the market these days but it has no standard GUI.
                    Back in the day, IBM came down from the mountain with two stone punch cards. On one was stamped "RPG" and the other "5250". IMO, old-school managers are sticking with RPG/5250 until IBM does the same thing with a new UI (which isn't going to happen).

                    Comment


                    • jtaylor___
                      jtaylor___ commented
                      Editing a comment
                      Although in their defense, IBM tried that unsuccessfully with Java.

                    • JonBoy
                      JonBoy commented
                      Editing a comment
                      And VA for RPG ... And EGL ...

                      Simple fact is though that IBM pretty much lost the ability to set the standard long before the AS/400 was born. If one wanted to make the argument that the AS/400 should have arrived from day 1 with a graphical interface then maybe - but only a slight maybe - could it have made a difference.

                    • jtaylor___
                      jtaylor___ commented
                      Editing a comment
                      People are waiting for a bus. They passed up a few they didn't like. Now they're just out of luck.

                  • #11
                    What I meant by "standard" was a GUI interface guaranteed to be available. Linux desktops for example are built on X11. Desktops can be changed but the apps still run because of the underlying X standard, the X interface is guaranteed to be available.

                    I agree, the browser is the standard GUI. On IBM/i there are many tools to provide this, but there isn't one that's guaranteed to be available. This is a problem for software vendors, which tool to support? This is a problem for administrators, excess costs.

                    For the vast majority of people what's on the screen forms their perception. It amazes me that in 2019 there is no GUI interface available on every IBM/i. In my view a standard GUI interface would be as important and as enabling as the shift from SNA to TCP/IP was. I use free RPG all the time, but that's for programmers not users. Ultimately it's users who buy the machine, not programmers.

                    Comment


                    • #12
                      What is "guaranteed to be available" is the Apache server and the system APIs for interfacing with it. But few people want to use that. Agreed that in theory X is on all linux boxes - but we're talking about a server not a desktop. X is not exactly widely used as an app development vehicle in multi-user situations even on Linux. Interestingly there was an X capability developed on the box in Rochester many years ago but nobody was interested and it died a death.

                      Anyway - we are a million miles off subject so I'll leave it here.

                      Comment


                      • #13
                        Wow, really a tender subject.
                        Going back a few years, I was in a JD Edwards shop that was a version or two behind in the package release and they were "NO ILE" to be used, in keeping with the JDE package. Just before my departure, they brought the package up to current and guess what.... It contained ILE, no FREE (please forgive my nomenclature) so then it was allowed. Albeit ILE fixed format was allowed, free-form was still verboten.

                        It seems to me that few, very few, shops are near, at or on the cutting edge. I think it all comes down to budget in these trying times. Small to medium sized businesses that still use the machine in question, are not too concerned with how a task is accomplished but are more concerned that it is and keep this position because it's cheaper than training or hiring someone with the experience who wants a higher salary.

                        Another shop I was in had an old timer doing code review and promotion to live and HE didn't want to move beyond the 1900 so, he was cheap, he was there since Moses, he was good and they (management) let him dictate what language was used. Sure a 1000 line program could be written in 300 lines but he wouldn't know what he was looking at and that would be a roadblock.

                        As for me, I don't care. I can and do use whatever it takes to get the task at hand done. If they want it in RPGII, RPGIII, RPGIV or carved in stone, fine as long as the paycheck keeps coming.
                        Everyday's a school day, what grade are you in?

                        Comment


                        • #14
                          JDE in particular, and other ISVs did the platform a major dis-service by refusing to take the simple step of converting to RPG IV from RPG III. IBM aided and abetted in this by continuing to throw support at JDE while not encouraging them to update. Just to put this in context - I know of a couple of JDE shops who got sick of waiting for meaningful updates and converted their code base themselves with few if any problems. Over a weekend! Truth of the matter was that JDE wanted people to switch to OneWorld and didn't even want to spend the pitifully small amount needed to convert.

                          The result has been a community convinced that "If JDE don't need it then neither do we".

                          Sadly that community has now realized that kids coming out of schools in the US are not interested in this weird fixed-form nonsensical language and avoid it like the plague. Folks like your "Moses" are retiring/dying at an increasing rate and their companies are looking to spending millions on platform moves that rarely work well.

                          Personally I, along with many I know, have refused to take on any work in anything but current versions of the language for many years now. The only time I'll touch RPG II or RPG II is if it is a conversion job. I value my sanity too much to want to keep messing with the old stuff. I regard making recommendations on how they cn mo=ve thir software forward part of the job I'm hired for. If they are not interested in that then I'm not interested in working for them.

                          Comment


                          • #15
                            My first 8 years as a dev, 2008 to 2016, I worked on a system that had its origins in the 80's. It was one instance of dozens around the world, but ours was unusual in that it was forked from the core version in 2000 and did not get any of the core version updates. The team that worked on it, had only 5 people at its alrgest in those 8 years, 2 at its lowest - me and the dev team lead.
                            He had his origins in the S/38 era, and was fairly backwards. We had to use fixed format, but extended factor 2 and BIFs were ok. Only native IO though, no embedded SQL. (sidenote - I am so glad I decided to teach myself embedded SQL in my last year there, as just as I got the hang of it I was made redundant, and being able to say I could do embedded SQL was vital to my getting my new job)

                            I asked him once why we did not use free format, when free format is more like other languages. He had three answers that are still inexplicable to me.
                            "because most RPG is fixed format"
                            "Because if RPG was more like other languages it would have no reason to exist"
                            "because it would be a step backwards, as our custom file field xref tool would not be able to parse free format"

                            He would also happily use factor1/2/result opcodes instead of BIFs if they took up less space than the BIF equivalent.

                            But I think, the truth was he simply stopped learning new capabilities early in the RPGIV era, since he felt that he could do anything he needed to do with the existing capabilities. Then he would see modern code, and would not be able to understand it. Then because he believes he is a talented programmer, he feels that if he cannot understand it it must be fundamentally difficult, and therefore worse than older code. He could not see that it was because his experience was now lacking.

                            Comment

                            Working...
                            X