有没有办法从CL命令中编辑RPGLE程序而不打开RPGLE程序?

发布于 2025-01-17 19:54:01 字数 480 浏览 3 评论 0原文

我有一个rpgle程序,如下所示,该程序在日期220318中具有标签ad11,但是对于其他日期,例如220317220323没有标签。是否有任何CL命令可以插入其他两个日期的ad11标签?或者,如果基于输入的日期作为输入参数,则可以写入任何程序以插入标签,如果位置1到4中没有标签?

显示标签的程序ad11 220318

“在此处输入图像描述”

任何建议/指导都将不胜感激。

I have a RPGLE program as below which has tags AD11 for date 220318 , but for other dates like 220317 and 220323 there are no tags. Is there any CL command that can insert AD11 tag for other two dates ? Or is there any program that can be written to insert tags if there is no tag present in position 1 to 4, based on the dates fed as input parameter?

Program showing tags AD11 for 220318

enter image description here

Any suggestions/guidance is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幸福丶如此 2025-01-24 19:54:01

CL 无法专门执行此操作,但您可以将 SQL 嵌入 CL 中,或者直接通过“STRSQL”运行 SQL。

注意:SQL 没有成员的概念,因此如果包含 RPGLE 源成员的文件有多个成员,您需要在运行脚本之前覆盖该成员。

CL 程序示例如下所示;

             PGM                                                             
                                                                         
             /* Override file name "QRPGLESRC" to "MYLIB/QRPGLESRC.SRCMBR" */
             OVRDBF     FILE(QRPGLESRC) TOFILE(MYLIB/QRPGLESRC) +          
                          MBR(SRCMBR) OVRSCOPE(*JOB)                       
                                                                         
             /* Update "MYLIB/QRPGLESRC.SRCMBR" */                           
             RUNSQL     SQL('UPDATE QRPGLESRC +                              
                                SET SRCDTA = ''AD11'' || SUBSTR(SRCDTA,5) +  
                              WHERE SRCDAT = 220408') +                      
                        COMMIT(*NONE)                                        
                                                                         
             /* Remove previous override */                                  
             DLTOVR     FILE(QRPGLESRC) LVL(*JOB)                            
                                                                         
             ENDPGM                                                                

CL can't do this specifically but what you could do is embed SQL within CL or just run SQL directly via "STRSQL".

n.b. SQL has no concept of members so if the file containing your RPGLE source member has multiple members you'll need to override to that member before running your script.

An example CL program would look like this;

             PGM                                                             
                                                                         
             /* Override file name "QRPGLESRC" to "MYLIB/QRPGLESRC.SRCMBR" */
             OVRDBF     FILE(QRPGLESRC) TOFILE(MYLIB/QRPGLESRC) +          
                          MBR(SRCMBR) OVRSCOPE(*JOB)                       
                                                                         
             /* Update "MYLIB/QRPGLESRC.SRCMBR" */                           
             RUNSQL     SQL('UPDATE QRPGLESRC +                              
                                SET SRCDTA = ''AD11'' || SUBSTR(SRCDTA,5) +  
                              WHERE SRCDAT = 220408') +                      
                        COMMIT(*NONE)                                        
                                                                         
             /* Remove previous override */                                  
             DLTOVR     FILE(QRPGLESRC) LVL(*JOB)                            
                                                                         
             ENDPGM                                                                
尹雨沫 2025-01-24 19:54:01

由于源成员存储在文件中,因此您可以创建 HLL(RPG 或 COBOL)程序来修改源成员中的数据。

Since source members are stored in files, you can create a HLL (RPG or COBOL) program to modify the data in the source member.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文