实现向txt文件循环输入字符与数字变量
大家好,我想向data_title.txt文件中输入从A100B100C100D100E100F100G100
A100B100C100D100E100F100G200
A100B100C100D100E100F100G300
...........................................................
A400B400C400D400E400F400G400
这4096行字符,我编了一个程序,没有成功,变量i,j,k,l,m,n,o的输出都有问题,都成了*号,没能输出数字,不知该怎么解决
/prep7
!*
pie1='A'
pie2='00B'
pie3='00C'
pie4='00D'
pie5='00E'
pie6='00F'
pie7='00G'
PPPP='00'
*CREATE,ansuitmp
*CFOPEN,'data_title','txt',' ',APPEND
*do,i,1,4,1
*do,j,1,4,1
*do,k,1,4,1
*do,l,1,4,1
*do,m,1,4,1
*do,n,1,4,1
*do,o,1,4,1
*VWRITE,pie1,%i%,pie2,%j%,pie3,%k%,pie4,%l%,pie5,%m%,pie6,%n%,pie7,%o%,PPPP,
(A1,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A2)
!
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*CFCLOS
*END
/INPUT,ansuitmp
!*
数组
想用数组来先存储,然后再用数组输出,也没成功/prep7
!*
*DIM,pie101,ARRAY,4096,,,
*DIM,pie202,ARRAY,4096,,,
*DIM,pie303,ARRAY,4096,,,
*DIM,pie404,ARRAY,4096,,,
*DIM,pie505,ARRAY,4096,,,
*DIM,pie606,ARRAY,4096,,,
*DIM,pie707,ARRAY,4096,,,
pp=1
pie1='A'
pie2='00B'
pie3='00C'
pie4='00D'
pie5='00E'
pie6='00F'
pie7='00G'
PPPP='00'
*do,i,1,4,1
*do,j,1,4,1
*do,k,1,4,1
*do,l,1,4,1
*do,m,1,4,1
*do,n,1,4,1
*do,o,1,4,1
pie101(pp)=i
pie202(pp)=j
pie303(pp)=k
pie404(pp)=l
pie505(pp)=m
pie606(pp)=n
pie707(pp)=o
pp=pp+1
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
pp=1
*CREATE,ansuitmp
*CFOPEN,'data_title','txt',' ',APPEND
*do,i,1,4,1
*do,j,1,4,1
*do,k,1,4,1
*do,l,1,4,1
*do,m,1,4,1
*do,n,1,4,1
*do,o,1,4,1
*VWRITE,pie1,pie101(pp),pie2,pie202(pp),pie3,pie303(pp),pie4,pie404(pp),pie5,pie505(pp),pie6,pie606(pp),pie7,pie707(pp),PPPP,
(A1,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A3,F1.0,A2)
pp=pp+1
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*CFCLOS
*END
/INPUT,ansuitmp
!*
原来变量范围不够,现在足够了仍然没法解决输出格式控制
/prep7!*
*DIM,ii,ARRAY,16384,,,
*DIM,jj,ARRAY,16384,,,
*DIM,kk,ARRAY,16384,,,
*DIM,ll,ARRAY,16384,,,
*DIM,mm,ARRAY,16384,,,
*DIM,nn,ARRAY,16384,,,
*DIM,oo,ARRAY,16384,,,
pp=1
pie1='A'
pie2='00B'
pie3='00C'
pie4='00D'
pie5='00E'
pie6='00F'
pie7='00G'
PPPP='00'
*do,i,1,4,1
*do,j,1,4,1
*do,k,1,4,1
*do,l,1,4,1
*do,m,1,4,1
*do,n,1,4,1
*do,o,1,4,1
ii(pp)=%i%
jj(pp)=%j%
kk(pp)=%k%
ll(pp)=%l%
mm(pp)=%m%
nn(pp)=%n%
oo(pp)=%o%
pp=pp+1
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
*enddo
pp=1
*CREATE,ansuitmp
*CFOPEN,'data_title','txt',' ',APPEND
*if,pp,ne,16385,then
*VWRITE,pie1,%ii(pp)%,pie2,jj(pp),pie3,kk(pp),pie4,ll(pp),pie5,mm(pp),pie6,nn(pp),pie7,oo(pp),PPPP,
(A1,d1.0,A3,d1.0,A3,d1.0,A3,d1.0,A3,d1.0,A3,d1.0,A3,d1.0,A2)
pp=pp+1
*endif
*CFCLOS
*END
/INPUT,ansuitmp
!* :@Q 期待高手指点一二
页:
[1]