473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Comparing string in C

kirubagari
158 100+
Expand|Select|Wrap|Line Numbers
  1. * Function: Generate_TO_Report(char* startDate,     -- Beginning of date range 
  2.  *     char* endDate,                             -- End of date range 
  3.  *     struct parameters*)                        -- Structure holding configurable parameters 
  4.  *
  5.  * Purpose: Get the 'Track Out' data for WaferSleuth from HDB. 
  6.  *          1. Fetch lot track-out list at first; 
  7.  *          2. Loop: get detail track-out information lot by lot
  8.  *          3. Loop: write track-out information to data file 
  9.  *             lot by lot. 
  10.  *
  11.  * 
  12. ************************************************************/
  13. int Generate_TO_Report(char* startDate, 
  14.             char* endDate, 
  15.             struct parameters* parms) 
  16.  
  17.     /***************************************************
  18.      * Preparation 
  19.      ***************************************************/ 
  20.     /* Variable declaration */ 
  21.     int numOfFiles = 0; 
  22.  
  23.     vc2_WipStepSK wipStep_SK; 
  24.     vc2_LotId lotId; 
  25.     vc2_StepId stepId; 
  26.     vc2_Device device; 
  27.     vc2_WaferQty qtyIn;
  28.     vc2_WaferQty qtyOut;
  29.     vc2_EqpId eqpId;
  30.     vc2_Technology tech; 
  31.     vc2_DateTime toTime; 
  32.     vc2_DateTime txnTime; 
  33.     vc2_Stage stage; 
  34.     vc2_UserId userId; 
  35.     vc2_GroupHistKey groupHistKey; 
  36.  
  37.     char currDateTime[20]; 
  38.  
  39.     /* Reset memory */ 
  40.     memset(currDateTime, 0, sizeof(currDateTime)); 
  41.  
  42.     #ifdef DEBUG 
  43.     printf("%s: Start to retrieve Track-Out Information\n", GetCurrDateTime(currDateTime));         
  44.     #endif 
  45.  
  46.     /***************************************************
  47.      * Query data  
  48.      ***************************************************/ 
  49.     /* Get Track Out lot list */ 
  50.     EXEC SQL DECLARE wsToCursor CURSOR FOR
  51.               SELECT wipstep_sk, trackouttime  
  52.                 FROM hdbxuser.fwhdbwipstephistory@hdbsil 
  53.                WHERE trackouttime BETWEEN :startDate AND :endDate
  54.                  AND stepid NOT LIKE '%SorterAction%'; 
  55.  
  56.     /* Open cursor */ 
  57.     EXEC SQL OPEN wsToCursor;
  58.  
  59.     /* Loop, fetching all salesperson's statistics.
  60.      * Cause the program to break the loop when no more
  61.      * data can be retrieved on the cursor.
  62.      */
  63.     EXEC SQL WHENEVER NOT FOUND DO break; 
  64.  
  65.     for( ; ;)  
  66.     {    
  67.         /* Reset memory */ 
  68.         memset(wipStep_SK, NULL, sizeof(wipStep_SK)); 
  69.         memset(lotId, NULL, sizeof(lotId)); 
  70.         memset(stepId, NULL, sizeof(stepId)); 
  71.         memset(device, NULL, sizeof(device)); 
  72.         memset(qtyIn, NULL, sizeof(qtyIn)); 
  73.         memset(qtyOut, NULL, sizeof(qtyOut)); 
  74.         memset(eqpId, NULL, sizeof(eqpId)); 
  75.         memset(tech, NULL, sizeof(tech)); 
  76.         memset(toTime, NULL, sizeof(toTime)); 
  77.         memset(txnTime, NULL, sizeof(txnTime)); 
  78.         memset(stage, NULL, sizeof(stage)); 
  79.         memset(userId, NULL, sizeof(userId)); 
  80.         memset(groupHistKey, NULL, sizeof(groupHistKey)); 
  81.  
  82.         /* Get WipStep_SK */ 
  83.         EXEC SQL FETCH wsToCursor INTO :wipStep_SK, :toTime;
  84.  
  85.         /* Skip to next lot if no data found */
  86.         EXEC SQL WHENEVER NOT FOUND GOTO NOTFOUND;
  87.  
  88.         /* Get detail lot information */     
  89.         EXEC SQL SELECT NVL (sh.lotid, 'NA') lotid, NVL (sh.stepid, 'NA') stepid,
  90.                NVL (lotdevice.attrvalue, 'NA') device, NVL (w.lotqtyin, 99) lotqtyin,
  91.                NVL (w.lotqtyout, 99) lotqtyout, NVL (sh.LOCATION, 'NA') eqpid,
  92.                NVL (SUBSTR (sh.productname || '.',
  93.                             1,
  94.                             INSTR (sh.productname || '.', '.', 1) - 1
  95.                            ),
  96.                     'NA'
  97.                    ) tech,
  98.                NVL (sh.trackouttime, 'NA') trackouttime, NVL (w.txntime,
  99.                                                               'NA') txntime,
  100.                NVL (lotstage.attrvalue, 'NA') stage, NVL (w.userid, 'NA') userid,
  101.                NVL (w.grouphistkey, 'NA') grouphistkey
  102.           INTO :lotId, :stepId, :device, :qtyIn, :qtyOut, :eqpId, 
  103.                    :tech, :toTime, :txnTime, :stage, :userId, :groupHistKey 
  104.           FROM hdbxuser.fwhdbwiplotattrinstance@hdbsil lotstage,
  105.                hdbxuser.fwhdbwiplotattrinstance@hdbsil lotdevice,
  106.                hdbxuser.fwhdbwiptransaction@hdbsil w,
  107.                hdbxuser.fwhdbwipstephistory@hdbsil sh
  108.          WHERE sh.wipstep_sk = w.wipstep_sk
  109.            AND w.activity = 'TrackOut'
  110.            AND lotstage.lot_sk = w.lot_sk 
  111.            AND w.txn_sk BETWEEN lotstage.startsequence AND lotstage.stopsequence
  112.            AND lotstage.attrname = 'Stage'   
  113.            AND lotstage.attrvalue != 'NONE'
  114.            AND lotdevice.lot_sk = w.lot_sk 
  115.            AND lotdevice.attrname = 'partProgId'   
  116.            AND w.txn_sk BETWEEN lotdevice.startsequence AND lotdevice.stopsequence
  117.            AND sh.wipstep_sk = :wipStep_SK 
  118.            AND w.txntime = :toTime; 
  119.  
  120.         /* Write info into data file */ 
  121.         if (strcmp (toTime,'11111111 00000000')==0)
  122.         {
  123.                  Write_To_PT_File (startDate, endDate, lotId, stepId, device, 
  124.                     qtyIn, qtyOut, eqpId, tech, toTime, stage, userId, parms);
  125.                 }
  126.               else 
  127.               {
  128.         Write_TO_DataFile(startDate, endDate, lotId, stepId, device, 
  129.                     qtyIn, qtyOut, eqpId, tech, toTime, stage, userId, parms);  
  130.               }
  131.         numOfFiles++; 
  132.         continue;
  133.  
  134. NOTFOUND: 
  135.         ; 
  136.     } 
  137.  
  138.     /* Close cursor */ 
  139.   EXEC SQL CLOSE wsToCursor;
  140.  
  141.   #ifdef DEBUG 
  142.   printf("  %d 'TO' data files are written successfully\n", numOfFiles); 
  143.     printf("%s: Succeed to retrieve Track-Out Information\n", GetCurrDateTime(currDateTime));         
  144.     #endif 
  145.  
  146.   return(numOfFiles); 
  147. } /* Generate_TO_Report */ 
  148.  
Attach is my code and im comparing the 2 string
When i compile it i got im encounter this error
Expand|Select|Wrap|Line Numbers
  1. -I/home/oracle/product/806/precomp/public -
  2. DSLMXMX_ENABLE -DSLTS_ENABLE    -c ExtractHDBDataForWaferSleuth_test.c
  3. ExtractHDBDataForWaferSleuth_test.c: In function `Generate_TO_Report':
  4. ExtractHDBDataForWaferSleuth_test.c:1332: character constant too long
  5. ExtractHDBDataForWaferSleuth_test.c:1332: warning: passing arg 2 of `strcmp' mak
  6. es pointer from integer without a cast
  7. *** Error code 1
  8. make: Fatal error: Command failed for target `ExtractHDBDataForWaferSleuth_test.
  9. o'
Kindly help..:)
Apr 6 '11 #1
1 1489
donbock
2,426 Expert 2GB
The error messages say the error is on line 1332. Which statement is that?

Perhaps it is line 122 in your snippet:
Expand|Select|Wrap|Line Numbers
  1. if (strcmp (toTime,'11111111 00000000')==0) 
Single quotes are used for character constants. Presumably you want to use double quotes to specify a string.
Apr 6 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pradyut | last post by:
I have made a program in which I'm trying to return the string in which the character is found. I'm doing this through pointers. I'm not able to figure out the correct way: printf("%s",...
4
by: Aaron | last post by:
How can i compare 2 strings and extract the difference? string1="abc zxy" string2="abc 123 zxy 234" extractedString ={"123", "234"} thanks Aaron
4
by: - Steve - | last post by:
The following line of vb.net code works fine: if(strAnswer.toUpper() = strUserAnswer.toUpper()) However in an ASP.net page I'm told Object reference not set to an instance of an object ...
3
by: Rich | last post by:
Hello, I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of objects. Dim entry As...
35
by: dtschoepe | last post by:
Greetings. I am working on an assignment and can't seem to get the right concept for something I'm attempting to do with enum data types. I have defined the following in my code: enum color...
4
by: MC felon | last post by:
what's the best way to compare two string elements? std::string cstr; if ( cstr.at(3) == cstr.at(2)) //do something or std::string cstr; if ( cstr == cstr) //do something ?
6
by: sabel | last post by:
Hi I am a problem comparing DDC AND "DDC" , the if statement is not working. here is my javascript code var DDC=document.getElementById("<%= hvalue.ClientID %>").value; ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.