从 COBOL AS400 调用 GENUUID

问题描述 投票:0回答:1

GENUUID 是 IBM 提供的过程。我可以找到从RPG调用GENUUID的示例,但需要在名称中添加_(下划线) EXTPRC('_GENUUID')

但我不知道如何在 COBOL 中执行此操作。

我尝试在 COBOL 调用命令中使用下划线,编译结束时出错,提示程序名称无效。

感谢任何帮助。谢谢!

ibm-midrange cobol
1个回答
0
投票

i5/OS 程序员工具包中找到这个

请注意,在 v7.3 中,IBM 增强了 GENUUID 以支持类型 4 UUID。如果您想生成类型 4 UUID,请使用此模板(我认为,我的 COBOL 非常生锈,从未在 IBM 中端系统上使用过)。请注意,COBOL 不支持 1 字节二进制文件,因此

pic x(1)
您需要将
x'04'
移至此
version
字段。

   01 uuid-t is typedef.
      05 bytes-in  pic 9(9) usage comp-4.
      05 bytes-out pic 9(9) usage comp-4.
      05 version   pic x(1).
      05 reserved  pic x(7).
      05 uuid      pic x(16).

 /**
  * This file is part of i5/OS Programmer's Toolkit.
  *
  * Copyright (C) 2010, 2011  Junlei Li.
  *
  * i5/OS Programmer's Toolkit is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * i5/OS Programmer's Toolkit is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with i5/OS Programmer's Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */

 /**
  * @file cbl002.cblle
  *
  * Test of:
  *  - _GENUUID
  *  - _PROPB
  */
   process
       NOMONOPRC.

   id division.
   program-id. cbl002.

   environment division.
   configuration section.
   special-names.
       copy mih-lnktyp.

   data division.
   working-storage section.
       copy mih-spt.
   01 result pic x(32).
   01 tmpl   type uuid-t.
   01 uuid-len pic 9(9) usage comp-4 value 32.

   procedure division.
   main-pgm.

       move all x"00" to tmpl.
       move 32 to bytes-in of tmpl.
       call "_GENUUID" using
           by reference tmpl.

       call program "CVTHC" using
           by reference result
           by reference uuid of tmpl
           by reference uuid-len.
       display "UUID generated: " result.

   see-you.
       stop run.
  *
  * Output of cbl002 might be the following:
  * UUID generated: 8E47800184071945AC820004AC117E94
  *

复制文件

 /**
  * This file is part of i5/OS Programmer's Toolkit.
  *
  * Copyright (C) 2010, 2011  Junlei Li.
  *
  * i5/OS Programmer's Toolkit is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * i5/OS Programmer's Toolkit is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with i5/OS Programmer's Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */

 /**
  * @file mih-spt.cblleinc
  *
  * Machine interface support instructions.
  */

  *A   B

 /**
  * Instruction template of GENUUID.
  */
   01 uuid-t is typedef.
      05 bytes-in  pic 9(9) usage comp-4.
      05 bytes-out pic 9(9) usage comp-4.
      05 reserved  pic x(8).
      05 uuid      pic x(16).

 /**
  * @BIF _GENUUID (Generate Universal Unique Identifier (GENUUID))
  *
  * @example test/cbl002.cblle
  */
  *    call "_GENUUID" using DS-of-type-uuid-t.

 /**
  * This file is part of i5/OS Programmer's Toolkit.
  *
  * Copyright (C) 2010, 2011  Junlei Li.
  *
  * i5/OS Programmer's Toolkit is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * i5/OS Programmer's Toolkit is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with i5/OS Programmer's Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */

 /**
  * @file mih-lnktyp.cblleinc
  *
  * Linkage type clauses for all system builtins are place here.
  *
  * @attention Make sure to copy this header in the SPECIAL-NAMES
  *            paragraph of your COBOL program.
  */

  *A   B

  * Compuation instructions.
       linkage type is sys for
           "_CMPSWP1"
           "_CMPSWP2"
           "_CMPSWP4"
           "_CMPSWP8"
           "_CPRDATA"
           "_DCPDATA"
           "_TSTBTS"
           "_CLRBTS"
           "_SETBTS"
           "_CVTEFN"
           "_CPYECLAP"
           "_LBCPYNV"
           "_LBCPYNVR"
           "_ACOS"
           "_ANDCSTR"
           "_ANDSTR"
           "_ASIN"
           "_ATAN"
           "_ATANH"
           "__strlen"
           "__strcmp"
           "_STRNCMPNULL"
           "_CMPTOPAD"
           "_COMSTR"
           "_COS"
           "_COSH"
           "_COT"
           "_CPYBYTES"
           "_CPYBO"
           "__strcpy"
           "_STRNCPYNULL"
           "_STRNCPYNULLPAD"
           "_EEXP"
           "_FINDBYTE"
           "_MEMCHR"
           "_STRCHRNULL"
           "_LN"
           "__memcmp"
           "__memcpy"
           "_MEMMOVE"
           "_MPYADD"
           "_MPYSUB"
           "_ORSTR"
           "_POWER"
           "_PROPB"
           "__memset"
           "_RETCA"
           "_SETCA"
           "_SCANX"
           "_SIN"
           "_SINH"
           "_TAN"
           "_TANH"
           "_TESTRPL"
           "_TESTSUBSET"
           "_XLATEB"
           "_XLATEB1"
           "_XORSTR"
           .

  * Date/Time/Timestamp instructions.
       linkage type is sys for "_CTD"
                               "_CDD"
                               "_CTSD".

  * Pointer/name resolution instructions.
       linkage type is sys for "_CMPPTRA"
                               "_CMPPTRT"
                               "_MATPTRL"
                               "_RSLVSP2"
                               "_RSLVSP4"
                               "_SETSPPFP".

  * Data pointer related instructions
       linkage type is sys for "_SETDP"
                               "_SETDPADR".

  * Space Management Instructions.
       linkage type is sys for "_CRTS"
                               "_DESS"
                               "_MATS"
                               "_MODS1"
                               "_MODS2".

  * Machine Interface support instructions.
       linkage type is sys for "_GENUUID".

  * Program Management instrucions.
       linkage type is sys for "_MATPGMNM".

  * Program execution instructions.
       linkage type is sys for "_NPMPARMLISTADDR"
                               "_MODASA".
© www.soinside.com 2019 - 2024. All rights reserved.