MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To move the data between Header and Trailer Records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
kris07
Beginner


Joined: 15 Jan 2007
Posts: 8
Topics: 4
Location: india

PostPosted: Tue Jul 24, 2007 9:23 am    Post subject: To move the data between Header and Trailer Records Reply with quote

Hi,

I have job which i need to move the data to discard file or proper file based on the records present in the file
Input File
aaa1111111
xxxxxxxxxx
xxxxxxxxxx
aaa2222222
xxxxxxxx
xxxxxxxx
bbb2222222
for example in the above scenario i need to move to proper file if
the data is in between aaa if i encounter bbb i have to move to discard file
i dont have limitation of records between aaa it can vary.
the record lenght is fixed of 80
can you please suggest.

regards,
kris07
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jul 24, 2007 9:50 am    Post subject: Reply with quote

my suggestions:
  1. provide a little more detail about the file - such as how to identify the header and trailer
  2. this is application programming, are you looking for a SORT solution or a programming solution?
  3. if you are looking for a SORT solution, post the question in the SORT/Utilities Forum
  4. your requirements are confusing to me. you have an input file and apparently two output files, one you call Proper and the other Discard.
    • what identifies records destined to the Proper file
    • which records should go to the Discard file?

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kris07
Beginner


Joined: 15 Jan 2007
Posts: 8
Topics: 4
Location: india

PostPosted: Thu Jul 26, 2007 8:24 am    Post subject: Reply with quote

Hi,
The header and trailer are identified by aaaa, the records identified between the aaa(Header and trailer) are proper files and the records which are not having trailer (aaaa) instead as (bbbb) they are identified as discard file.

we have towrite in application programming
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Jul 26, 2007 8:58 am    Post subject: Reply with quote

kris07,

This is one of the simplest program you can ever get. You should be able to write this without any problem. I Hate to spoon feed you but here it is. Hopefully you learn something out of it.

Code:

FD INPUT-FILE                               
    RECORDING MODE IS F                     
    LABEL RECORDS ARE STANDARD             
    BLOCK CONTAINS 0 RECORDS               
    DATA RECORD IS INPUT-REC.               
                                           
01 INPUT-REC.                               
   05 RECORD-IDENTIFIER           PIC X(03).
   05 FILLER                      PIC X(77).
                                           
FD PROPER-FILE                             
    RECORDING MODE IS F                     
    LABEL RECORDS ARE STANDARD             
    BLOCK CONTAINS 0 RECORDS               
    DATA RECORD IS PROPER-REC.             
                                           
01 PROPER-REC                     PIC X(80).
                                           
FD DISCARD-FILE                             
    RECORDING MODE IS F                     
    LABEL RECORDS ARE STANDARD             
    BLOCK CONTAINS 0 RECORDS               
    DATA RECORD IS DISCARD-REC.             
                                           
01 DISCARD-REC                    PIC X(80).
 WORKING-STORAGE SECTION.                                   
 01 S-EOF-INPUT                 PIC X(01)  VALUE 'N'.       
 01 W-HDR-TRLR-COUNT            PIC S9(01) VALUE 0.         
 PROCEDURE DIVISION.                                         
                                                             
       PERFORM 1000-INITIALIZATION                           
                                                             
       PERFORM 2000-MAIN-PROCESS UNTIL S-EOF-INPUT = 'Y'     
                                                             
       CLOSE  INPUT-FILE                                     
              PROPER-FILE                                   
              DISCARD-FILE                                   
                                                             
       GOBACK                                               
       .                                                     
                                                             
 1000-INITIALIZATION.                                       
*************************************************************
*THIS PARAGRAPH OPENS THE FILES AND DOES THE PRIME READ.    *
*************************************************************
                                                             
       OPEN INPUT  INPUT-FILE                               
            OUTPUT PROPER-FILE                               
                   DISCARD-FILE                             
                                                             
       PERFORM 4000-READ-INPUT                               
       .                                                     
                                                             
 2000-MAIN-PROCESS.                                         
*************************************************************
*THIS PARAGRAPH PERFORMS THE MAIN LOGIC                     *
*************************************************************
                                                             
      IF W-HDR-TRLR-COUNT > 0                               
         IF RECORD-IDENTIFIER = 'AAA'                       
            IF W-HDR-TRLR-COUNT = 2                         
               MOVE +0  TO W-HDR-TRLR-COUNT                 
            END-IF                                           
         END-IF                                             
         WRITE PROPER-REC FROM INPUT-REC                     
      ELSE                                                   
         WRITE DISCARD-REC FROM INPUT-REC                   
      END-IF                                                 
      PERFORM 4000-READ-INPUT                               
      .                                                     
                                                             
 4000-READ-INPUT.                                           
*************************************************************
*THIS PARAGRAPH READS THE INPUT FILE.                       *
*************************************************************
                                                             
      READ INPUT-FILE                                       
        AT END                                               
           MOVE 'Y'            TO S-EOF-INPUT               
       NOT AT END                                           
           IF RECORD-IDENTIFIER = 'AAA'                     
              ADD +1 TO W-HDR-TRLR-COUNT                     
           END-IF                                           
      END-READ                                               
      .                                                     


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group