kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Aug 24, 2004 11:57 am Post subject: |
|
|
Pavani,
Here is alternative solution. This previous solution involves with too many control cards.This solution involves only 1 set of control cards.
Code: |
//************************************************************
//* THE FIRST STEP WILL PUT AN "X" IN POSITION 80 OF THE *
//* INPUT FILE OF 500TH RECORD. *
//************************************************************
//STEP0100 EXEC PGM=FILEAID,REGION=4M
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//DD01 DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SYSIN DD *
$$DD01 UPDATE SELECT=500,R=(80,C'X'),OUT=0
/*
//************************************************************
//* THE SECOND STEP WILL WRITE OUT EVERY RECORD AND *
//* IF AN "X" IS FOUND IN POSITION 80, A NEW RECORD WITH *
//* COMMIT WILL BE WRITTEN AFTER EVERY 500TH RECORD. *
//************************************************************
//STEP0300 EXEC PGM=FILEAID,REGION=4M
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//DD01 DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SQLCARDS DD DSN=YOUR OUTPUT SQL UPDATE STATEMENT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(15,5),RLSE)
//SYSIN DD *
$$DD01 USER IF=(80,NE,C'X'),
MOVE=(1,80C' '),
MOVE=(1,C'UPDATE TEMPTBL'),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C" SET FIELD3 = 'ABCD'"),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C' WHERE NUMBER = '),
MOVE=(+0,C"'"),
MOVE=(+0,9,1),
MOVE=(+0,C"'"),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C'AND CHARACTER = '),
MOVE=(+0,C"'"),
MOVE=(+0,1,10),
MOVE=(+0,C"';"),
WRITE=SQLCARDS,
IF=(80,EQ,C'X'),
MOVE=(1,80C' '),
MOVE=(1,C'UPDATE TEMPTBL'),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C" SET FIELD3 = 'ABCD'"),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C' WHERE NUMBER = '),
MOVE=(+0,C"'"),
MOVE=(+0,9,1),
MOVE=(+0,C"'"),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C'AND CHARACTER = '),
MOVE=(+0,C"'"),
MOVE=(+0,1,10),
MOVE=(+0,C"';"),
WRITE=SQLCARDS,
MOVE=(1,80C' '),
MOVE=(1,C'COMMIT;'),
WRITE=SQLCARDS
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|