AS400上的C编程

除了一般的crtlib的方式,用strsql再“create shema miaoyu”方式创建lib,有一个好处就是所有操作都会写journal。

当然这样做的后果是,源文件都会以table的形式保存下来,因为在schema中pysical file为表:

image

为了安全起见,将当前目录和当前库设为自己的目录和文件:

查看当前目录:dspcurdir;创建目录:crtdir ‘/home/miaoyu’;设置当前目录:chgcurdir ‘/home/miaoyu’

查看当前库:dsplib中type.CUR;设置当前库:chgcurlib miaoyu

然后可以进行文件创建编译了:

image

 

addpfm file(miaoyu/csrc2) mbr(mytestc) , 其中miaoyu/csrc2为/root/home/miaoyu下文件名;mytestc为为这个model创建的member名称

image

 

wrkobjpdm = wo (work with objects using pdm)

image

 

通过“12” : work with :

image

 

通过“2” : Edit ,进入 SEU ,进行文件编辑

image

 

/*  ****************************** Begin: SEU Editor 使用方法 **************************** */

0. 初始状态:

image

 

1. 插入行:在数据行最左边输入I2(I: Insert, 2: 2行):

image

image

 

F5去除空行;F10光标定位到seu命令行上。

I* 插入行

保存成员:SEU=>FILE,会回到work with members using pdm界面,可以继续选2进行编辑,或者14进行编译,等。

用file进入work with members using pdm界面后,文件即保存了,此时9 “保存”会出现savobj的界面:

image

另外如果用F3,则会进入提示是否保存的界面。

image

 

删除行:D。D*为删除从该行开始的*行。

image

 

用格式行插入源语句:IF命令:如IFPF2为增加一行格式行与两个空行(Insert Format Line)

image

 

提示插入源语句并全屏:seu命令行处输入“set expert”

IP命令:如IPPF,SEU在显示底部给出PF的提示(Insert Promote)

退出:set expert off

 

用F修改一个格式行,用F5可以去除格式行,D也可以。

image

 

查找命令:

SEU=>set match (查找大小写匹配的字符串)

SEU=>F ‘DAPT’ (查找dapt)

用执行键或F16,光标定位到下一个匹配字串

 

复制粘贴:

编辑成员时F15出现浏览/复制显示;F12取消分屏

image

image

image

 

用提示修改记录:P;F5取消提示

image

 

自定义promote的提示:

在本例中用户的提示叫做CD,包括CUSTNAME, CUSTADDRES, CUSTCITY, CUSTPOSTAL

a. 定义提示码:在编辑中(比如插入两行,直接使用是不可以的)P?, IP?, 或F23

image

F23进入选择界面:

image

image

 

image

 

在第13行第1列给出CUSTNAME的题头:

image

依次将剩余三个提示加上,最后形如:

image

显示提示的方法:用F11

 

修改SEU编辑状态只能大写之类的问题:

编辑状态下F13

image

/*  ****************************** End: SEU Editor 使用方法 **************************** */

当编辑好了,想进行编译或运行时,默认的设置是提交到batch中,如下最下行提示信息所示:

image

我们如果想让他立即执行,则可以对default属性进行修改:F18

image

将compile in batch和run in batch改掉。然后看到了编译界面:

image

编译成功后显示:

image

退出,然后wo miaoyu 可以看到:

image

然后12选择work with,进入work with programs界面,执行的话,用9调用:

image

然后看到了屏显:

image

如果期望打在journal中:需要修改源文件,调用as400的接口:

image

转载于:https://www.cnblogs.com/lizmy/archive/2011/05/17/2048722.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是C语言实现Prim算法的示例代码: ```c #include <stdio.h> #include <stdbool.h> #define INF 999999 int main() { int graph[10][10], visited[10], dist[10], parent[10]; int vertices, edges, i, j, min_dist, min_vertex, total_weight = 0; // input number of vertices and edges printf("Enter number of vertices: "); scanf("%d", &vertices); printf("Enter number of edges: "); scanf("%d", &edges); // initialize graph with INF for(i = 0; i < vertices; i++) { for(j = 0; j < vertices; j++) { graph[i][j] = INF; } } // input edges and weights for(i = 0; i < edges; i++) { int u, v, w; printf("Enter edge %d and weight: ", i + 1); scanf("%d %d %d", &u, &v, &w); graph[u][v] = w; graph[v][u] = w; } // initialize visited, dist, parent arrays for(i = 0; i < vertices; i++) { visited[i] = false; dist[i] = INF; parent[i] = -1; } // start from vertex 0 dist[0] = 0; // loop over all vertices for(i = 0; i < vertices; i++) { // find unvisited vertex with minimum distance min_dist = INF; for(j = 0; j < vertices; j++) { if(!visited[j] && dist[j] < min_dist) { min_dist = dist[j]; min_vertex = j; } } // mark vertex as visited visited[min_vertex] = true; // update distances and parents of adjacent vertices for(j = 0; j < vertices; j++) { if(graph[min_vertex][j] != INF && !visited[j] && graph[min_vertex][j] < dist[j]) { dist[j] = graph[min_vertex][j]; parent[j] = min_vertex; } } } // calculate total weight of MST for(i = 0; i < vertices; i++) { total_weight += dist[i]; } // print MST edges and total weight printf("MST Edges: \n"); for(i = 1; i < vertices; i++) { printf("(%d, %d)\n", parent[i], i); } printf("Total weight of MST: %d", total_weight); return 0; } ``` 该程序通过从第一个顶点开始,一步一步构建最小生成树。visited数组记录已经访问过的顶点,dist数组记录每个顶点到已访问顶点的最小距离,parent数组记录每个顶点在最小生成树中的父节点。程序输出最小生成树的边和总权值。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值