+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Initializing a field with the value of '

  1. #1
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    This is problably RPG IV "101", but how do I set a field called field_1 and intialize the value to be ' ? (single Apostrophe) For example, like this (although this does not work): d field_1 s 1 inz(''') Thanks

  2. #2

    Default Initializing a field with the value of '

    Add one more '.
     D x s 1 inz('''') 
    I have never understood this! HTH, Joe

  3. #3
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    You could probably initialize the field with the hex value of '. I'm not sure what hex code that is though.

  4. #4
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    Don't know if RPG can deal with Hex but a quote is Hex'7D' bobh

  5. #5
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    Joe, You're right, it does seem weird, but the concept is that inside of single quotes, it takes 2 single quotes to make 1. '(''for what it''s worth'')' = ('for what it's worth') Kevin

  6. #6
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    This works as well using the hex code: D Field_1 S 1A Inz(x'7D')

  7. #7
    D.Handy Guest

    Default Initializing a field with the value of '

    Dave, You could probably initialize the field with the hex value of ' Indeed you could, and as Bob points out you could try x7D. But there is a downside to doing it this way: if you ever have to deal with various code pages for multinational support or translation (who knows who will buy the company?), using the hex constant will not necessarily translate correctly. Using a constant of '''' (four single quotes) will translate to a single quote in other pages, regardless of what hex value that turns out to be. Since RPG only allows the single quote as a string constant delimiter, embedded single quotes as in o'clock must be doubled so the language parser knows it was intentional rather than an error. Thus o'clock becomes o''clock or 'o''clock' as a string constant. Remove the letters and what remains are four single quotes. Looks weird to someone who hasn't seen it before, but then so does RPG. Doug

  8. #8
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    Thanks to all for your help

  9. #9
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    Looks weird to someone who hasn't seen it before, but then so does RPG.
     D oug W hy(do) y o u S aytha t:'?' 

  10. #10
    Guest.Visitor Guest

    Default Initializing a field with the value of '

    Doug is right barbara. Its weired for rpg when it sees a " ' " somewhere inbetween the string. How will it interpret the " ' " as part of the string or end of " ' ". Isn't it weired for RPG?? Elan

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Practical Array Processing: Initializing and Sorting
    By johnny_dt99@yahoo.com in forum RPG
    Replies: 2
    Last Post: 01-08-2009, 05:34 PM
  2. Problem with Date Type field and field Reference File
    By David Abramowitz in forum General
    Replies: 2
    Last Post: 07-27-2006, 10:32 AM
  3. Moving a date defined field to a numeric field using free format
    By buck.calabro@commsoft.net in forum General
    Replies: 2
    Last Post: 05-25-2004, 02:00 AM
  4. Initializing disc drives
    By Guest.Visitor in forum General
    Replies: 2
    Last Post: 06-25-2002, 04:46 AM
  5. Moving numeric field to date data type field.
    By Guest.Visitor in forum Application Software
    Replies: 19
    Last Post: 08-20-2000, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts