IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Modify 1st Detail and Last Detail record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Wed Jan 02, 2008 4:27 pm
Reply with quote

Hi,

I have a file of FB and LRECL=80. File contains one header record and several detail records as represented below:

Code:

20080102ACT1201
   01201   .Y NATWIDE 701 20080102 1234567890123456 V
   01202   .N NATWIDE 702 20080102 1234567890123455 V
.................
   01229   .N NATWIDE 702 20080102 1234567890123455 V&



Please note that there are 3 blank spaces at first 3 position on every detail record. There is no Trailer record and I dont know how many detail record exists. There is a '&' character at last detail record on position 54 and is always fixed at that position.

I want to add a string "VISAC" at position 3 only on my 1st detail record and 5 blank spaces at the same position for all other detail records. I also want to wipe out "&" character at last record. My expected output file is

Code:

20080102ACT1201
  VISAC 01201   .Y NATWIDE 701 20080102 1234567890123456 V
        01202   .N NATWIDE 702 20080102 1234567890123455 V
...............
        01229   .N NATWIDE 702 20080102 1234567890123455 V


Can anyone help?
Back to top
View user's profile Send private message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Wed Jan 02, 2008 4:36 pm
Reply with quote

A minor change in my input file. The input file has got "&" character at position 54 for all the detail records and I want to eliminate it at only last detail record.

Input File:
Code:

20080102ACT1201
   01201   .Y NATWIDE 701 20080102 1234567890123456 V&
   01202   .N NATWIDE 702 20080102 1234567890123455 V&
.................
   01229   .N NATWIDE 702 20080102 1234567890123455 V&


Expected Output file:
Code:

20080102ACT1201
  VISAC 01201   .Y NATWIDE 701 20080102 1234567890123456 V&
        01202   .N NATWIDE 702 20080102 1234567890123455 V&
...............
        01229   .N NATWIDE 702 20080102 1234567890123455 V
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jan 02, 2008 6:15 pm
Reply with quote

You can use a DFSORT job like this:

Code:

//CRESYMN  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=...  input file (FB/80)
//SORTOUT  DD DSN=&&TEMP1,DISP=(,PASS),SPACE=(TRK,(1,1)),UNIT=SYSDA
//SYSIN    DD *
  OPTION COPY
  OUTFIL NODETAIL,REMOVECC,
    TRAILER1=(C'TCOUNT,+',COUNT=(EDIT=(TTTTTTTT))) 
/*
//STEP1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD DSN=&&TEMP1,DISP=(OLD,PASS)
//SORTIN   DD DSN=...  input file (FB/80)
//SORTOUT  DD DSN=...  output file (FB/80)
//SYSIN    DD *
  OPTION COPY
  INREC IFOUTLEN=80,
        IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(81,8,ZD,EQ,2),
                BUILD=(3:C'VISAC',3,52)),
        IFTHEN=(WHEN=(81,8,ZD,EQ,TCOUNT),
                BUILD=(8:3,51)),
        IFTHEN=(WHEN=(81,8,ZD,GT,2),
                BUILD=(8:3,52))
/*
Back to top
View user's profile Send private message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Wed Jan 02, 2008 7:25 pm
Reply with quote

Thank you so much for your timely help Krisprems. I got the desired output.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top