ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Qshell and special characters

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

  • Qshell and special characters

    Hello everyone,

    I've recently started working with an old AS/400 machine and making my first programms in IBM Control Language.
    However, right now I stumbled across a curious problem which I can't find a simple solution for.

    The task itself is simple enough: I want a list of all JPGs in a few specific folders and their subfolders. This is easily enough achieved
    with Qshells ls - R but I noticed that the listing occasionally just ends. I tracked the problem down to certain files that came from
    our art departments Macs. Specifically, it seems Qshell can't handle the interpunct character ( ยท ) when it occurs in file names.

    The code I'm currently using is
    PGM
    OVRDBF FILE(STDOUT) TOFILE(JQTEMP/JPGL) +
    OVRSCOPE(*CALLLVL)
    CLRPFM FILE(JPGP)
    CD +
    DIR('folder path in question')

    QSH CMD('ls -R')
    ENDPGM

    Is there any way to handle these special characters or a better way to list folder contents at all? Sadly telling the art guys to stop using
    the interpunct isn't an option. You know how it is.

    Thanks in advance.

  • #2
    Re: Qshell and special characters

    please attach 1 of the jpgs or if unable just a name.
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Qshell and special characters

      Here are two examples:
      69-307  1.jpg
      69-307  2.jpg
      (Looks like Firefox doesn't even have the appropriate font to display the character for me, showing [F022] instead. Looks like it might not even really BE an interpunct!)

      I've attached an edited version (workplace interals, no need to spread those around the net openly) of one of the files. For some reason, I am able to open it via Paint but not via IrfanView. It's zipped since the image itself is like 2500x3000 pixels.
      Attached Files

      Comment


      • #4
        Re: Qshell and special characters

        What are you going to do with the list? Perhaps you could try piping the output of the ls command to an IFS file.
        Code:
        export QIBM_CCSID=1252; ls -R '/yourPath' > '/home/myDir/myList-1252.TXT'

        Comment


        • #5
          Re: Qshell and special characters

          Sorry for the late reply.

          The JPGs from the list will be added to our inventory tool which right now contains all product information EXCEPT a picture. It's supposed to be easily updateable so our art department just has to upload new pictures to a folder on our server and we can do the rest.

          Hence why these broken JPGs are giving me such a headache, if the art guys accidentally upload them in the future the whole list will be broken. If the update happens automatically we might not even notice.

          Comment

          Working...
          X