CONVERSION CODES

92 views
Skip to first unread message

Jackson Ramos

unread,
Dec 8, 2021, 10:37:14 AM12/8/21
to Pick and MultiValue Databases
Is there a list of conversion codes for OCONV and ICONV I'm trying to find what G-2 converts to in OCONV, also this probably won't be my first post asking about PICK/BASIC i'm fairly new to the language, about 2 months in of learning.

Martin Phillips

unread,
Dec 8, 2021, 11:11:17 AM12/8/21
to mvd...@googlegroups.com

Hi Jackson,

 

Conversion codes vary a little between platforms but the G code is, as far as I know, the same everywhere. Here is a description from the QM documentation:

 

The group conversion code treats the source data as being formed from a number of components separated by a delimiter character and extracts specified components. It works identically on input and output conversions.

 

Gcn     Returns the first n components of the source data delimited by character c.

 

Gscn    Skips s components and then returns the next n components of the source data delimited by character c.

 

Example

 

Consider a date stored in character form as 03/10/98. The G conversion code could be used to extract components of this date:

 

G/1 returns 03

 

G/2 returns 03/10

 

G1/1 returns 10

 


Martin

 

From: mvd...@googlegroups.com <mvd...@googlegroups.com> On Behalf Of Jackson Ramos
Sent: 08 December 2021 15:37
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: [mvdbms] CONVERSION CODES

 

EXTERNAL EMAIL




Is there a list of conversion codes for OCONV and ICONV I'm trying to find what G-2 converts to in OCONV, also this probably won't be my first post asking about PICK/BASIC i'm fairly new to the language, about 2 months in of learning.

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/31f5b742-83db-469e-83a1-06efd219a79bn%40googlegroups.com.

================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.

philippe GRACIA

unread,
Dec 8, 2021, 11:26:29 AM12/8/21
to Pick and MultiValue Databases
hello.
G is for string extract
- is the delimiter
2 is the string returned
ex: abc-def , g-2 will return def

Steve Trimble

unread,
Dec 8, 2021, 1:22:34 PM12/8/21
to mvd...@googlegroups.com
click here:

index 'Index' you will find: Conversion codes
of course, all of these work with openQM (it is the best of PICK)

Computerized Data Mgmt Inc
Steve Trimble
(501) 772-3450 cell / text


--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.

James A

unread,
Dec 8, 2021, 5:01:06 PM12/8/21
to mvd...@googlegroups.com
Here's a little utility we use to test different formats in a loop; and the Help display shows some of them.

Though some are only valid for our internal 'FORM.FMT' routine (ex: SSN) which I haven't included; so modify as necessary.

(you'll also need to refactor 'PARSE.CMDLINE'; but in this case it doesn't do much;and remove reference to INPUT.OCONV)

- James Adrig


%< -------------------------------


* ======================================= FMT.TEST ======================================
* @TCL: Print the ICONV and OCONV of a value: "FMT.TEST <value>"
* =======================================================================================
* 16.Jul.2013 james: Enhance '-O' option to show everything on a single line. Fix -F too.
* 08.Feb.2012 james: Major cleanup and 'H'elp added.
* 23.Apr.2007 jim: Comment and clean up: We use this a lot !
* =======================================================================================
* $Id$
* =======================================================================================

* PRINT "PRECISION:": ; INPUT PREC
* PRECISION PREC

  gosub ParseCommandLine

  if String$ = '' then
    crt "String to Format:": ; input String$
  end

  if String$ # '' then
    *  Hack if you need to test control chars or whatever!?:
    *if String = 'J' then String = 'TEST':CHAR(13):CHAR(10):"SECOND LINE"
    *
    if FormatList # '' then
      NumFormats = dcount( FormatList, @SVM )
      for N.F = 1 to NumFormats
        Format = FormatList<1, 1, N.F> ; gosub FormatOne
      next N.F
    end else
      gosub FormatLoop
    end
  end
  crt ; crt
stop

FormatLoop:
  if String$ = "''" then String$ = ""
  loop
    crt
    crt "Format or 'H' for Help :": ; input Format:
   while Format # '' do
   
    if Format = 'H' then
      gosub FormatHelp
    end else
      gosub FormatOne
    end
  repeat
return

FormatOne:
  if FormFmtOnly then
    gosub FormFmt
    if FormatList # '' then crt Format:
    crt space(5 - len(Format)):":":F.String:":"
  end else
    crt ; crt
    crt "'String Format'       :":String$ Format:":"
    crt "FMT(String, Format)   :":FMT(String$, Format):":"
    crt "oconv(String, Format) :":oconv(String$, Format):":"
    crt "iconv(String, Format) :":iconv(String$, Format):":"
    gosub FormFmt
    crt "FORM.FMT '":Format:"'  :":F.String:":"
   
    if InputOconv then
      OString = String$
      call INPUT.OCONV(OString, Format)  ;*  Note that this CHANGES 'OString' !
      crt "INPUT.OCONV(OString, Format) :":OString:":"
    end
  end
return

FormFmt:
  F.String = String$ ; call FORM.FMT(Format, F.String)
return

* =======================================================================================

ParseCommandLine:
  $include RMS.BP EQU.CMDLINE
  CMDLINE.OPTIONS = ''
  call PARSE.CMDLINE(@SENTENCE, mat CMDLINE, CMDLINE.OPTIONS)
  if CMD.HELP then gosub Help ; stop

  String$ = CMD.ARG.S<1, 1>

  locate 'F' in CMD.FLAG.S<1> setting LOC then FormatList = CMD.PARAM.S<1,LOC> else FormatList = ''

  locate 'O' in CMD.FLAG.S<1> setting LOC then FormFmtOnly = @TRUE else FormFmtOnly = @FALSE
  locate 'I' in CMD.FLAG.S<1> setting LOC then InputOconv  = @TRUE else InputOconv = @FALSE
  locate 'V' in CMD.FLAG.S<1> setting LOC then Verbose = @TRUE else Verbose = @FALSE

return

Help:
  crt "FMT.TEST <String> [-O ] [ -H ]"
  crt
  crt "  Test different Format functions on a String; by default this will try:"
  crt
  crt "    - The 'space' format; i.e. <string><space><format>"
  crt "    - The FMT() function (normally the same as above)."
  crt "    - oconv(String, Format)"
  crt "    - iconv(String, Format)"
  crt "    - FORM.FMT (the function used by most DSI UV programs)"
  crt
  crt " Options:"
  crt "   -O             : FORM.FMT only."
  crt "   -I             : Include INPUT.OCONV (NOT done by default)"
  crt "   -H             : This help."
  gosub FormatHelp
return

FormatHelp:
  crt "=========================================================================================="
  crt
  crt "  Formats :"
  crt
  crt " DD   : DAY.FORMAT        : Day of Month ONLY"
  crt " DDST : XST.DATE.FORMAT   : 1st, 2nd, etc. for Dates"
  crt " XST  : XST.NUMBER.FORMAT : 1st, 2nd, etc. if NOT a Date"
  crt " DTM  : DAYS.TO.MONTHS    : Number of Months since 0 Date."
  crt " DEM  : DAYS.END.MONTH    : DAYS since 0 Date at the of end of the month"
  crt " DTD  : DATE.TO.DAYS      : DAYS since 0 Date"
  crt " MTD  : MONTHS.TO.DAYS    : DAYS on the 1st of the Month"
  crt " FN   : FIRST.NAME        : ex: 'James Robert Adrig II' returns 'James Robert'"
  crt " MC/MCM : Mixed Case      : ex: 'LAND AND LOTS' returns 'Land And Lots'"
  crt " MLM  : Mixed Lower Case  : ex: 'FHA OR NOTHING' returns 'FHA or Nothing'"
  crt " MN   : MIDDLE.NAME       : ex: 'James Robert Adrig II' returns 'Robert'"
  crt " LN   : LAST.NAME         : ex: 'James Robert Adrig II' returns 'Adrig II'"
  crt " LNO  : LAST.NAME.ONLY    : ex: 'James Robert Adrig II' returns 'Adrig'"
  crt " SN   : SUFFIX.NAME       : ex: 'James Robert Adrig II' returns 'II'"
  crt " FNO  : FIRST.NAME.ONLY   : ex: 'James Robert Adrig II' returns 'James'"
  crt " SSN  ; SOCIAL.SECURITY.NUMBER : ex: changes '123456789' to '123-45-6789'"
  crt " MCU  : Upper Case ('Mask Character Upper')"
  crt " MCL  : Lower Case ('Mask Character Lower')"
  crt " Z'   : ZIP.CODE.FORMAT"
  crt " PH'  : PHONE.FORMAT"
  crt " D2Y' : 2 digit Year"
  crt " D4-YMD[Z4,2,2] : 4 digit Year; Year/Month/Day format (!?!)"
  crt " Rdx/y': ROUND the value to the nearest x/y; ex: R1/4, R1/16; 'd'irection='U'p;'D'own;default closest (see ROUND.IT)"
  crt " C    : CENTER"
  crt " A    : ALPHA         : ex 152 becomes 'ONE HUNDRED AND FIFTY TWO'; etc."
  crt " GxCy : Group Extract : ex ?"
  crt
  crt "Otherwise the standard formats are used if it starts with 'D'(dates), 'M'(Masked Decimal), or 'T'(time):"
  crt
  crt " MR20#6 : 2 Decimals; 0 scaling; right justified in 6 characters."
  crt
  crt " Note that 'MD' and 'MR' formats are the same ONLY for oconv/iconv; not '' or 'FMT' function!"
  crt
  crt " In general, use 'MR' for formattig for output; 'MD' only for moving the decimal. (?)"
  crt
return


On Wed, Dec 8, 2021 at 7:37 AM Jackson Ramos <jackso...@qualco.com> wrote:
Is there a list of conversion codes for OCONV and ICONV I'm trying to find what G-2 converts to in OCONV, also this probably won't be my first post asking about PICK/BASIC i'm fairly new to the language, about 2 months in of learning.

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages