Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Modify 1st Detail and Last Detail record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Modify 1st Detail and Last Detail record
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    Post subject: Reply to: Modify 1st Detail and Last Detail record
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us